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

Fix module resolution #614

Merged
merged 5 commits into from Apr 1, 2024
Merged

Fix module resolution #614

merged 5 commits into from Apr 1, 2024

Conversation

TimJentzsch
Copy link
Collaborator

Description:

When running npm run dev, everything worked fine.
But with npm run build && npm run start, we got the following error:

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/app/dist/src/logger' imported from /app/dist/src/_main.js
    at finalizeResolution (node:internal/modules/esm/resolve:264:11)
    at moduleResolve (node:internal/modules/esm/resolve:917:10)
    at defaultResolve (node:internal/modules/esm/resolve:1130:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:396:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:365:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:240:38)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:85:39)
    at link (node:internal/modules/esm/module_job:84:36) {
  code: 'ERR_MODULE_NOT_FOUND',
  url: 'file:///app/dist/src/logger'
}

This is because the --experimental-specifier-resolution=node flag got removed in nodejs/node#44859.
Instead, we now use the commonjs-extension-resolution-loader custom loader and specify it with the --loader flag.

See also https://github.com/orgs/nodejs/discussions/46298#discussioncomment-4744722.

Checklist:

  • Tested the bot on both clients with a few commands
  • Updated the README if necessary
  • Updated the version string in the package.json if necessary

@TimJentzsch TimJentzsch merged commit 32dc816 into main Apr 1, 2024
4 checks passed
@TimJentzsch TimJentzsch deleted the fix-module-resolution branch April 1, 2024 16:20
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

Successfully merging this pull request may close these issues.

None yet

2 participants