Externalized module import / dynamic import will introduce redundant runtime in webpack / Rspack. Dynamic import will be hoisted to the top level (https://github.com/webpack/webpack/issues/17986). Furthermore, the import and import() should be leave unchanged.
[x] preserve import() when import() is supported in that Node.js version in CJS. (BLOCK: can't distinguish static / dynamic from external callback except adding new information) https://github.com/webpack/webpack/discussions/16272
Bundler supports
Tracking the bundler supports for the optimal artifact (webpack[^1] and Rspack).
[^1]: Reference: https://github.com/webpack/webpack/issues/17121
CJS support
ESM artifacts won't break by scope isolation when bundling module bailout from concatenation (usually CJS module).
Tree shakable export
ESM artifacts should be tree-shakable.
Remove unnecessary webpack exports runtime
Externals P0
Externalized module import / dynamic import will introduce redundant runtime in webpack / Rspack. Dynamic import will be hoisted to the top level (https://github.com/webpack/webpack/issues/17986). Furthermore, the
import
andimport()
should be leave unchanged."module-import"
external typeimport()
whenimport()
is supported in that Node.js version in CJS. (BLOCK: can't distinguish static / dynamic from external callback except adding new information) https://github.com/webpack/webpack/discussions/16272Dynamic import (Chunk splitting) P1
Can't be static analysis because of the public path runtime.
Preserve CSS Import
CSS import statement will be extracted out.
Node.js Shims
Miscellaneous
require
require
andrequire.resolve
require(...)
should be either behave like esbuild (sniff and throw as a fallback) or be shimmed withcreateRequire
.require.resolve(...)
should be either behave like esbuild (sniff and throw as a fallback) or be shimmed withcreateRequire
.require(...)
with externals should work like__non_webpack_require__
require.resolve(...)
should preserve as-is.require('./' + expression + '.js')
like dynamic require with expression. (BLOCK: https://github.com/microsoft/rushstack/blob/main/webpack/preserve-dynamic-require-plugin/README.md not available in Rspack assucceedModule
is readonly in JS side)Extra runtime when bundling single module
Re-export with property access or eval
Multiple entries P2
Export in library works only for last entry module