Skip to content

Question: Does webpack's tree-shaking work with babel-preset-design-system-react? #1265

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

Closed
zaki-yama opened this issue Feb 6, 2018 · 2 comments

Comments

@zaki-yama
Copy link
Contributor

I have a question.
In Getting Started, it says

This preset will keep Babel compatible with Design System React and allow ES6 module benefits such as tree-shaking.

but when I see the preset definition,
https://github.com/salesforce/design-system-react/blob/master/preset/index.js

"modules": false is not specified in babel-preset-env.
So I just wondered if ES6 modules features like tree-shaking really works using this preset. What do you think?

@interactivellama
Copy link
Contributor

interactivellama commented Feb 6, 2018

You are right. modules should be false for that. I believe I initially wrote the preset with modules:false but then left it out in order to ship it. modules:false was causing issues.

For instance, we still have some CommonJS to clean up like module.exports = RadioGroup;. Changing to ES6 modules would be a breaking change.

What would you recommend? I think we can turn it on once the CommonJS is gone. If you can change the few modules and get Storybook and the tests going. I'll update the preset.

@zaki-yama
Copy link
Contributor Author

@interactivellama
I really appreciate for your reply.
I understand, and found there are some components which uses module.exports = xxx style.

I think we can turn it on once the CommonJS is gone.

I agree. I wish I could be your help for migrating the modules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants