You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running routes-gen with a setup that is all ESM based I get the following error.
Error [ERR_REQUIRE_ESM]: require() of ES Module /<myproject_path>/remix.config.js from /<myproject_path>/node_modules/@routes-gen/remix/dist/index.js not supported.
Instead change the require of remix.config.js in /<myproject_path>/node_modules/@routes-gen/remix/dist/index.js to a dynamic import() which is available in all CommonJS modules.
at loadRemixConfig (/<myproject_path>/node_modules/@routes-gen/remix/dist/index.js:46:14)
at Object.<anonymous> (/<myproject_path>/node_modules/@routes-gen/remix/dist/index.js:59:21)
at //<myproject_path>/node_modules/routes-gen/dist/cli.js:142:118
at async bootstrap (/<myproject_path>/node_modules/routes-gen/dist/cli.js:142:14) {
code: 'ERR_REQUIRE_ESM'
}
Failed to load the Remix config at "remix.config.js". Falling back to the following defaults: {"appDirectory":"app"}.
[SUCCESS] Exported 100 routes to "app/routes.d.ts".
So it doesn't actually fail but I was able to easily remedy this with changing a couple lines of the built remix driver in the dist index.js file to use dynamic import instead.
to be a dynamic import would solve it although I am unsure if that would have ramifications for other users sticking strictly to commonjs. Looking at the error it shouldn't.
Happy to help work on the problem and test the solution out if needed.
Describe the bug
When running routes-gen with a setup that is all ESM based I get the following error.
So it doesn't actually fail but I was able to easily remedy this with changing a couple lines of the built remix driver in the dist index.js file to use dynamic import instead.
I believe changing this
routes-gen/packages/routes-gen-remix/src/index.ts
Line 25 in 32c50bb
Happy to help work on the problem and test the solution out if needed.
Your Example Website or App
https://stackblitz.com/edit/remix-run-remix-j9fqdd
Steps to Reproduce the Bug or Issue
npm run gen-routes
from the terminal in the example app and you can see the errorExpected behavior
clean output e.g.
Screenshots or Videos
No response
Platform
Additional context
No response
The text was updated successfully, but these errors were encountered: