@@ -20,6 +20,7 @@ const eslintFormatter = require('react-dev-utils/eslintFormatter');
20
20
const ModuleScopePlugin = require ( 'react-dev-utils/ModuleScopePlugin' ) ;
21
21
const paths = require ( './paths' ) ;
22
22
const getClientEnvironment = require ( './env' ) ;
23
+ const getTopLevelModules = require ( './getTopLevelModules' ) ;
23
24
24
25
// Webpack uses `publicPath` to determine where the app is being served from.
25
26
// It requires a trailing slash, or the file assets will get an incorrect path.
@@ -97,20 +98,23 @@ module.exports = {
97
98
// `web` extension prefixes have been added for better support
98
99
// for React Native Web.
99
100
extensions : [ '.web.js' , '.mjs' , '.js' , '.json' , '.web.jsx' , '.jsx' ] ,
100
- alias : {
101
- // @remove -on-eject-begin
102
- // Resolve Babel runtime relative to react-scripts.
103
- // It usually still works on npm 3 without this but it would be
104
- // unfortunate to rely on, as react-scripts could be symlinked,
105
- // and thus babel-runtime might not be resolvable from the source.
106
- 'babel-runtime' : path . dirname (
107
- require . resolve ( 'babel-runtime/package.json' )
108
- ) ,
109
- // @remove -on-eject-end
110
- // Support React Native Web
111
- // https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
112
- 'react-native' : 'react-native-web' ,
113
- } ,
101
+ alias : Object . assign (
102
+ {
103
+ // @remove -on-eject-begin
104
+ // Resolve Babel runtime relative to react-scripts.
105
+ // It usually still works on npm 3 without this but it would be
106
+ // unfortunate to rely on, as react-scripts could be symlinked,
107
+ // and thus babel-runtime might not be resolvable from the source.
108
+ 'babel-runtime' : path . dirname (
109
+ require . resolve ( 'babel-runtime/package.json' )
110
+ ) ,
111
+ // @remove -on-eject-end
112
+ // Support React Native Web
113
+ // https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
114
+ 'react-native' : 'react-native-web' ,
115
+ } ,
116
+ getTopLevelModules ( )
117
+ ) ,
114
118
plugins : [
115
119
// Prevents users from importing files from outside of src/ (or node_modules/).
116
120
// This often causes confusion because we only process files within src/ with babel.
0 commit comments