Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work on Windows #30

Closed
ikx94 opened this issue Apr 13, 2024 · 5 comments
Closed

Doesn't work on Windows #30

ikx94 opened this issue Apr 13, 2024 · 5 comments

Comments

@ikx94
Copy link

ikx94 commented Apr 13, 2024

Hey, I was really eager to try your package but sadly I can't make it work on Windows. I've spent the last 2 hours trying to figure it out, with the help of ChatGPT 4, and I still can't make it work.

The error message I get is:

"Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 's:'"

I found that Next.js users have been getting a similar error, and this is the proposed solution:

vercel/next.js#64386

I tried changing the IMPORTER in bin/console.ts and bin/server.ts to:

const IMPORTER = (filePath: string) => {
if (filePath.startsWith('./') || filePath.startsWith('../')) {
const fileUrl = new URL(filePath, APP_ROOT).href;
if (process.platform === 'win32') {
return import(fileUrl.replace(/^file:////, 'file://'));
}
return import(fileUrl);
}
return import(filePath);
};

But that didn't work.

I give up, at least for now. If you could take a look, I would highly appreciate it.

@ikx94
Copy link
Author

ikx94 commented Apr 13, 2024

By the way, I don't get this error with the official Adonis starter packages.

@jarle
Copy link
Owner

jarle commented Apr 14, 2024

That's interesting, it seems like absolute ESM imports doesn't work on windows without a file:// prefix. I will look into fixing this.

@jarle
Copy link
Owner

jarle commented Apr 15, 2024

I don't have a windows PC to test on, but I believe this should work now (fixed in #23).
Could you verify by setting up a new project with the command mentioned in the readme? 🙌

npm init adonisjs -- -K="github:jarle/remix-starter-kit"

@ikx94
Copy link
Author

ikx94 commented Apr 15, 2024

Just tried it and it seems to work, it run normally and I got to see the page that says Welcome to Remix
...powered by AdonisJS 😎and the blog posts.

Thank you for that. Can I ask you, is Remix configured in SPA mode or in any specific way?

@jarle
Copy link
Owner

jarle commented Apr 15, 2024

Nice! The default application is Remix with SSR. For enabling SPA mode you can add ssr: false to the remix plugin in vite.config.ts and follow the remix documentation here: https://remix.run/docs/en/main/future/spa-mode#usage

@jarle jarle closed this as completed Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants