-
-
Notifications
You must be signed in to change notification settings - Fork 618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tree Shaking not working #3829
Comments
I have tested with webpack, here is the result of webpack: (() => {
"use strict";
var o,
e = {
"./a/lib.js": (o, e, r) => {
r.d(e, { isDev: () => s });
const s = !0;
},
},
r = {};
function s(o) {
var t = r[o];
if (void 0 !== t) return t.exports;
var l = (r[o] = { exports: {} });
return e[o](l, l.exports, s), l.exports;
}
(s.d = (o, e) => {
for (var r in e)
s.o(e, r) &&
!s.o(o, r) &&
Object.defineProperty(o, r, { enumerable: !0, get: e[r] });
}),
(s.o = (o, e) => Object.prototype.hasOwnProperty.call(o, e)),
(o = s("./a/lib.js")),
console.log(o.isDev, "--isDev"),
o.isDev ? console.log("p111") : console.log("p222"),
console.log("b111");
})(); (I enabled the |
@IWANABETHATGUY Why is the build result different from my webpack build? Is it the webpack version |
Please disable the |
@IWANABETHATGUY Yes, In Webpack build, set |
related to #3823, because we don't implement that feature yet. |
thank |
since it's not a bug now, closed it now we will support concatModules in the future |
System Info
System:
OS: macOS 13.0
CPU: (10) arm64 Apple M1 Pro
Memory: 1.81 GB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.18.0 - ~/.nvm/versions/node/v16.18.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v16.18.0/bin/yarn
npm: 8.19.2 - ~/.nvm/versions/node/v16.18.0/bin/npm
pnpm: 8.6.0 - ~/.nvm/versions/node/v16.18.0/bin/pnpm
Browsers:
Chrome: 114.0.5735.198
Safari: 16.1
npmPackages:
@rspack/cli: ^0.2.7 => 0.2.7
Details
Rspack
source code
dist code
Webpack5
The same code Tree Shanking can work properly
webpack: 5.75.0
source code
dist code
Reproduce link
No response
Reproduce Steps
rspack build -c ./webpack.config.js
The text was updated successfully, but these errors were encountered: