Skip to content

Commit

Permalink
Safely assume module type for node_modules (#5052)
Browse files Browse the repository at this point in the history
  • Loading branch information
lixiaoyan authored and Timer committed Sep 21, 2018
1 parent 7be14b9 commit f9849a2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/babel-preset-react-app/dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f9849a2

Please sign in to comment.