-
Notifications
You must be signed in to change notification settings - Fork 262
Tree shaking seems not working. #140
Comments
And rollup works fine. config:
index.js: import {autobind} from 'core-decorators'
export default autobind |
hmm if it works in rollup, but not webpack2, that seems to suggest webpack2 is the culprit--though something I'm doing might be making it less than ideal to webpack2's logic 😄 . If you have time to make an example repo I can use to reproduce I'll take a closer look? This might be the issue: facebook/create-react-app#2748 and webpack/webpack#2867 |
Yeah, it is really easy to reproduce. Run all these lines: create-react-app react-demo
cd react-demo
npm install core-decorators --save App.js: ...
import {autobind} from 'core-decorators';
... Then run Edit App.js:
Then run I solve this issue by using |
Any news on this? |
@jayphelps @benneq I just did some testing by forcing FYI that's the rule I use in my webpack config as a workaround: {
test: /node_modules\/core-decorators/,
sideEffects: false
} |
I use core-decorators in create-react-app project, and use function in this way:
But the bundle size doesn't reduce.
When I change in this way:
The bundle size seems good to me.
Did I misunderstanding tree-shaking?
Let me know if you need more infomation.
The text was updated successfully, but these errors were encountered: