Closed ikx94 closed 7 months ago
By the way, I don't get this error with the official Adonis starter packages.
That's interesting, it seems like absolute ESM imports doesn't work on windows without a file://
prefix. I will look into fixing this.
I don't have a windows PC to test on, but I believe this should work now (fixed in https://github.com/jarle/remix-adonisjs/pull/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"
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?
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
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:
https://github.com/vercel/next.js/pull/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.