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

Migration error with node ESM module #137

Closed
tatchi opened this issue Nov 11, 2023 · 2 comments
Closed

Migration error with node ESM module #137

tatchi opened this issue Nov 11, 2023 · 2 comments

Comments

@tatchi
Copy link

tatchi commented Nov 11, 2023

I get this error in a Node project that compiles to ESM modules

Exited failure state: Error: {"reason":"import-error","message":"Could not import migration \"1_create_people\"\n\nError [ERR_REQUIRE_ESM]: require() of ES Module /Users/corentin/Dev/temp/use-relative-time/dist/src/migrations/0001_create_people.js from /Users/corentin/Dev/temp/use-relative-time/node_modules/.pnpm/@[email protected]_@[email protected][email protected]/node_modules/@sqlfx/sql/Migrator/Node/dist/sqlfx-sql-Migrator-Node.cjs.dev.js not supported.\nInstead change the require of 0001_create_people.js in /Users/corentin/Dev/temp/use-relative-time/node_modules/.pnpm/@[email protected]_@[email protected][email protected]/node_modules/@sqlfx/sql/Migrator/Node/dist/sqlfx-sql-Migrator-Node.cjs.dev.js to a dynamic import() which is available in all CommonJS modules.","_tag":"MigrationError"}

I made a reproduction repo available at https://github.com/tatchi/sqlx-repro

pnpm i
pnpm run build
node dist/src/main.js

It works if we compile to CommonJS. You can test with common branch

git checkout common
pnpm run build
node dist/src/main.js
@tim-smart
Copy link
Owner

tim-smart commented Nov 15, 2023

We have updated the effect build processes, which I think will have fixed this.

@tatchi
Copy link
Author

tatchi commented Nov 15, 2023

Thanks, I confirm it works now 🤗

@tatchi tatchi closed this as completed Nov 15, 2023
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