v5.105.0
📦 webpackView on GitHub →
✨ 7 features🐛 18 fixes🔧 7 symbols
Summary
This release introduces significant improvements to module resolution, especially around Workers and conditional imports, and adds configuration flexibility for TypeScript paths via the new tsconfig resolver option.
Migration Steps
- If you were using tsconfig-paths-webpack-plugin, replace it by configuring the tsconfig option in resolver options.
✨ New Features
- Allow resolving worker module by export condition name when using new Worker().
- Detect conditional imports to avoid compile-time linking errors for non-existent exports.
- Added the tsconfig option for the resolver options (replacement for tsconfig-paths-webpack-plugin). Can be false (disabled), true (use the default tsconfig.json file to search for it), a string path to tsconfig.json, or an object with configFile and references options.
- Support import.defer() for context modules.
- Added support for array values to the devtool option.
- Improve rendering node built-in modules for ECMA module output.
- Unknown import.meta properties are now determined at runtime instead of being statically analyzed at compile time.
🐛 Bug Fixes
- Fixed ESM default export handling for .mjs files in Module Federation.
- Optimized import.meta.env handling in destructuring assignments by using cached stringified environment definitions.
- Respect the stats.errorStack option in stats output.
- Fixed a bug where declaring a module variable in module scope would conflict with the default moduleArgument.
- Fix VirtualUrlPlugin to set resourceData.context for proper module resolution. Previously, when context was not set, it would fallback to the virtual scheme path (e.g., virtual:routes), which is not a valid filesystem path, causing subsequent resolve operations to fail.
- Fixed Worker self-import handling to support various URL patterns (e.g., import.meta.url, new URL(import.meta.url), new URL(import.meta.url, import.meta.url), new URL("./index.js", import.meta.url)). Workers that resolve to the same module are now properly deduplicated, regardless of the URL syntax used.
- Reuse the same async entrypoint for the same Worker URL within a module to avoid circular dependency warnings when multiple Workers reference the same resource.
- Fixed a bug where a self-referencing dependency would have an unused export name when imported inside a web worker.
- Fix missing export generation when concatenated modules in different chunks share the same runtime in module library bundles.
- Fixed import.meta.env.xxx behavior: when accessing a non-existent property, it now returns empty object instead of full object at runtime.
- Improved parsing error reporting by adding a link to the loader documentation.
- Fix typescript types.
- Add declaration for unused harmony import specifier.
- Fix compressibility of modules while retaining portability.
- Optimize source map generation: only include ignoreList property when it has content, avoiding empty arrays in source maps.
- Preserve star exports for dependencies in ECMA module output.
- Consider asset modulem to be side-effect free.
- Avoid generating JavaScript modules for CSS exports that are not used, reducing unnecessary output and bundle size.