If I add a esmodule target I get this error. After debugging, I realized this line in Parcel returns true. As far as I know, Nodejs supports Dynamic imports natively.
let needsDynamicImportPolyfill = !bundle.env.isLibrary && !bundle.env.supports('dynamic-import', true);
@parcel/runtime-js: No import() polyfill available for context 'node'
Error: No import() polyfill available for context 'node'
at nullthrows (.../setup-cpp/node_modules/.pnpm/nullthrows@1.1.1/node_modules/nullthrows/nullthrows.js:7:15)
at getLoaderRuntime
(.../setup-cpp/node_modules/.pnpm/@parcel+runtime-js@2.0.0-canary.1720_@parcel+core@2.0.0-canary.1718_@swc+helpers@0.5.12_/node_modules/@parcel/runtime-js/lib/JSRuntime.js:360:42)
at Object.apply
(.../setup-cpp/node_modules/.pnpm/@parcel+runtime-js@2.0.0-canary.1720_@parcel+core@2.0.0-canary.1718_@swc+helpers@0.5.12_/node_modules/@parcel/runtime-js/lib/JSRuntime.js:171:29)
at applyRuntimes
(.../setup-cpp/node_modules/.pnpm/@parcel+core@2.0.0-canary.1718_@swc+helpers@0.5.12/node_modules/@parcel/core/lib/applyRuntimes.js:114:44)
at async BundlerRunner.bundle
(.../setup-cpp/node_modules/.pnpm/@parcel+core@2.0.0-canary.1718_@swc+helpers@0.5.12/node_modules/@parcel/core/lib/requests/BundleGraphRequest.js:334:25)
at async Object.run
(.../setup-cpp/node_modules/.pnpm/@parcel+core@2.0.0-canary.1718_@swc+helpers@0.5.12/node_modules/@parcel/core/lib/requests/BundleGraphRequest.js:132:17)
at async RequestTracker.runRequest
(.../setup-cpp/node_modules/.pnpm/@parcel+core@2.0.0-canary.1718_@swc+helpers@0.5.12/node_modules/@parcel/core/lib/RequestTracker.js:784:20)
at async Object.run
(.../setup-cpp/node_modules/.pnpm/@parcel+core@2.0.0-canary.1718_@swc+helpers@0.5.12/node_modules/@parcel/core/lib/requests/ParcelBuildRequest.js:52:7)
at async RequestTracker.runRequest
(.../setup-cpp/node_modules/.pnpm/@parcel+core@2.0.0-canary.1718_@swc+helpers@0.5.12/node_modules/@parcel/core/lib/RequestTracker.js:784:20)
at async Parcel._build
(.../setup-cpp/node_modules/.pnpm/@parcel+core@2.0.0-canary.1718_@swc+helpers@0.5.12/node_modules/@parcel/core/lib/Parcel.js:369:11)
🐛 bug report
If I add a
esmodule
target I get this error. After debugging, I realized this line in Parcel returnstrue
. As far as I know, Nodejs supports Dynamic imports natively.🎛 Configuration (.babelrc, package.json, cli command)
The
modern
config fails.https://github.com/aminya/setup-cpp/tree/modern
🤔 Expected Behavior
Not sure why
isLibrary
matters here in determining the dynamic import support. But it could be related.😯 Current Behavior
💁 Possible Solution
🔦 Context
💻 Code Sample
https://github.com/aminya/setup-cpp/tree/modern https://github.com/aminya/setup-cpp/pull/265
🌍 Your Environment