Skip to content

Commit f9849a2

Browse files
lixiaoyanTimer
authored andcommitted
Safely assume module type for node_modules (#5052)
#5046 (comment)
1 parent 7be14b9 commit f9849a2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/babel-preset-react-app/dependencies.js

+5
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ module.exports = function(api, opts) {
3232
}
3333

3434
return {
35+
// Babel assumes ES Modules, which isn't safe until CommonJS
36+
// dies. This changes the behavior to assume CommonJS unless
37+
// an `import` or `export` is present in the file.
38+
// https://github.com/webpack/webpack/issues/4039#issuecomment-419284940
39+
sourceType: 'unambiguous',
3540
presets: [
3641
isEnvTest && [
3742
// ES features necessary for user's Node version

0 commit comments

Comments
 (0)