-
-
Notifications
You must be signed in to change notification settings - Fork 27k
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
Remove module field in production webpack config #2485
Conversation
This crops up in the form of uglify errors during a production build, e.g. facebook#2236, facebook#2433, facebook#2475. The suggestion there is to transpile deps down to ES5 and/or remove `module`. However, `module` is there specifically to indicate ES module support, which uglify doesn't support, so ask webpack not to resolve it.
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at [email protected]. Thanks! If you are contributing on behalf of someone else (eg your employer): the individual CLA is not sufficient - use https://developers.facebook.com/opensource/cla?type=company instead. Contact [email protected] if you have any questions. |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
We encourage the use of Packages shipping code which requires compilation should be using the Please refer to the module field specification. Also see the lengthy discussion in webpack/webpack#1979. |
While we greatly appreciate your contribution, this is not something we will be merging. |
For clarification, the issue isn't with modules; it's because the packages contain ES6 function syntax/object syntax (et al.), e.g.
|
Thanks! That and rollup wiki's pkg.module cleared it up for me. |
This crops up in the form of uglify errors during a production build, e.g. #2236, #2433, #2475. The suggestion there is to transpile deps down to ES5 and/or remove
module
. This is correct with respect tomain
, howevermodule
is there specifically to indicate ES module support, which uglify doesn't support. Therefore, ask webpack not to resolve it.You can test this by depending on a package that ships with multiple targets i.e.
main
pointing to a transpiled/common JS target andmodule
targeting ES6+, e.g. tlvince-reduced-test-case-cra-module:src/index.js
Before:
After: