Have you used AI?
No
Bug Description
This example:
git clone -bwebpack_require_stylus https://github.com/dilyanpalauzov/webpack-i20146
cd webpack-i20146/
npm update && npm run bundle
produces in dist/t.js, shown below. As __webpack_require__ is not used, it should not be emitted.
/******/ // The require scope
/******/ var __webpack_require__ = {};
/******/
/************************************************************************/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/************************************************************************/
;// ./src/js/c.js
class C {
constructor() {
}
}
/* harmony default export */ const c = (C);
;// ./src/index.js
/* harmony default export */ const src = (c);
export { src as default };
Link to Minimal Reproduction and step to reproduce
git clone -bwebpack_require_stylus https://github.com/dilyanpalauzov/webpack-i20146
cd webpack-i20146/
npm update && npm run bundle
Expected Behavior
The lines with /******/ at the beginning ⇔ all the __webpack_require__ should not be emitted, because it is not used.
Actual Behavior
__webpack_require__ is generated.
Environment
System:
OS: Linux 6.19 …
CPU: (4) x64 …
Memory: …
Binaries:
Node: 22.22.2 - /usr/bin/node
Yarn: 4.6.0 - /usr/local/bin/yarn
npm: 10.9.7 - /usr/bin/npm
Browsers:
Firefox: 151.0.1
Firefox Developer Edition: 151.0.1
Packages:
css-loader: ^7.1.4 => 7.1.4
stylus-loader: ^8.1.3 => 8.1.3
webpack: ^5.107.1 => 5.107.1
webpack-cli: ^7.0.2 => 7.0.2
Is this a regression?
None
Last Working Version
No response
Additional Context
No response
Have you used AI?
No
Bug Description
This example:
produces in dist/t.js, shown below. As
__webpack_require__is not used, it should not be emitted.Link to Minimal Reproduction and step to reproduce
Expected Behavior
The lines with
/******/at the beginning ⇔ all the__webpack_require__should not be emitted, because it is not used.Actual Behavior
__webpack_require__is generated.Environment
System: OS: Linux 6.19 … CPU: (4) x64 … Memory: … Binaries: Node: 22.22.2 - /usr/bin/node Yarn: 4.6.0 - /usr/local/bin/yarn npm: 10.9.7 - /usr/bin/npm Browsers: Firefox: 151.0.1 Firefox Developer Edition: 151.0.1 Packages: css-loader: ^7.1.4 => 7.1.4 stylus-loader: ^8.1.3 => 8.1.3 webpack: ^5.107.1 => 5.107.1 webpack-cli: ^7.0.2 => 7.0.2Is this a regression?
None
Last Working Version
No response
Additional Context
No response