-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Description
Bug report
What is the current behavior?
When using side effect import on an ignored module (or RawModule), the module would always exist in __webpack_modules__ with empty content.
/******/ var __webpack_modules__ = ({
/***/ 914:
/***/ (() => {
/* (ignored) */
/***/ })
/* harmony import */ var foo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(914);A typical use case for an ignored module is importing a module intended solely for debugging purposes.
For a real-world case, see: lynx-family/lynx-stack#1250
import '@lynx-js/react/debug'
Imports to such ignored modules are expected not to contribute to an increase in bundle size in production.
If the current behavior is a bug, please provide the steps to reproduce.
https://github.com/colinaaa-reproductions/webpack-repro-tree-shaking-raw-module
What is the expected behavior?
The ignored module should be deleted if not used.
Other relevant information:
webpack version: 5.99.9
Node.js version: 22
Operating System: macOS
Additional tools: