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

@magda/xxx NPM packages might throw "Dynamic require of "os" is not supported" error after v3 #3516

Closed
t83714 opened this issue Apr 14, 2024 · 1 comment
Assignees
Labels

Comments

@t83714
Copy link
Contributor

t83714 commented Apr 14, 2024

@magda/xxx NPM packages might throw "Dynamic require of "os" is not supported" error after v3

Since v3, we have used build to build @magda/xx packages.

When bundling common deps, esbuild doesn't include a cjs shim but throws an error when require is not available (e.g. when released as an ESM module). See evanw/esbuild#1921

Solution could be:

  • not bundle dep when not have to
  • Or auto add cjs shim via esbuild inject
    • Should only add shim to node version bundle for web version, this option should be skipped
@t83714 t83714 added the bug label Apr 14, 2024
@t83714 t83714 self-assigned this Apr 14, 2024
@t83714 t83714 changed the title DockerUtils v3.0.1 was released incorrectly with commonjs code @magda/xxx NPM packages might throw "Dynamic require of "os" is not supported" error after v3 Apr 14, 2024
t83714 added a commit that referenced this issue Apr 18, 2024
#3516 Fixed released @magda NPM package esbuild commonjs bundle issue (also #3514)
@t83714
Copy link
Contributor Author

t83714 commented Apr 18, 2024

closed via PR: #3517

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

No branches or pull requests

1 participant