Safely assume module type for node_modules (#5052)

https://github.com/facebook/create-react-app/pull/5046#issuecomment-423501823
This commit is contained in:
XiaoYan Li
2018-09-21 20:46:41 +08:00
committed by Joe Haddad
parent 7be14b914f
commit f9849a2662

View File

@@ -32,6 +32,11 @@ module.exports = function(api, opts) {
}
return {
// Babel assumes ES Modules, which isn't safe until CommonJS
// dies. This changes the behavior to assume CommonJS unless
// an `import` or `export` is present in the file.
// https://github.com/webpack/webpack/issues/4039#issuecomment-419284940
sourceType: 'unambiguous',
presets: [
isEnvTest && [
// ES features necessary for user's Node version