Open
Description
Bundler supports
Tracking the bundler supports for the optimal artifact (webpack1 and Rspack).
CJS support
ESM artifacts won't break by scope isolation when bundling module bailout from concatenation (usually CJS module).
- webpack: feat: root module is less prone to be wrapped in IIFE webpack/webpack#18348
- Rspack: feat: root module is less prone to be wrapped in IIFE rspack#6697
Tree shakable export
ESM artifacts should be tree-shakable.
- webpack: feat: tree shakable output for module library webpack/webpack#18272
- Rspack: feat: tree shakable output for module library rspack#6877
Remove unnecessary webpack exports runtime
- webpack: fix: only render init code when need moduleRemapping webpack/webpack#18338
- webpack: feat: reduce unnecessary exports runtime webpack/webpack#18565
- Rspack: feat: reduce unnecessary exports runtime rspack#7102
Externals P0
Externalized module import / dynamic import will introduce redundant runtime in webpack / Rspack. Dynamic import will be hoisted to the top level (webpack/webpack#17986). Furthermore, the import
and import()
should be leave unchanged.
- support
"module-import"
external type - Rspack misaligned: Port fix: only render init code when need moduleRemapping webpack/webpack#18338. However, the simple module remapping runtime in Rspack (https://github.com/web-infra-dev/rspack/blob/main/crates/rspack_core/src/external_module.rs#L266-L269) is totally unused now.
- dynamic external introduce webpack runtime
- In concatenated module, static external module namespace import re-assign breaks tree shaking (demo)
- Not work with star export from external module (bundleless) Preserve star exports for externalized dependencies in module output webpack/webpack#15270
- preserve
import()
whenimport()
is supported in that Node.js version in CJS. (BLOCK: can't distinguish static / dynamic from external callback except adding new information) Allow Dynamic Import in `commonjs2` webpack/webpack#16272
Dynamic import (Chunk splitting) P1
Can't be static analysis because of the public path runtime.
- Output statically resolvable dynamic import expressions webpack/webpack#15697
- Single runtime chunk incompatible with library output in Webpack 5 webpack/webpack#12801
Preserve CSS Import
CSS import statement will be extracted out.
Node.js Shims
Miscellaneous
require
require
and require.resolve
- ESM:
-
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
.
-
- CJS:
-
require(...)
with externals should work like__non_webpack_require__
-
require.resolve(...)
should preserve as-is. - preserve
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
- Rspack: feat(modern-module): force concaten single module rspack#7317
- Rspack: fix(modern-module): compat with more export cases rspack#7394
Re-export with property access or eval
Multiple entries P2
Export in library works only for last entry module
Footnotes
-
Reference: https://github.com/webpack/webpack/issues/17121 ↩
Metadata
Assignees
Labels
No labels
Activity