@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 https://github.com/evanw/esbuild/issues/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
@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 https://github.com/evanw/esbuild/issues/1921Solution could be:
inject