File tree 2 files changed +18
-0
lines changed
2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
18
18
const InterpolateHtmlPlugin = require ( 'react-dev-utils/InterpolateHtmlPlugin' ) ;
19
19
const WatchMissingNodeModulesPlugin = require ( 'react-dev-utils/WatchMissingNodeModulesPlugin' ) ;
20
20
const eslintFormatter = require ( 'react-dev-utils/eslintFormatter' ) ;
21
+ const ModuleScopePlugin = require ( 'react-dev-utils/ModuleScopePlugin' ) ;
21
22
const getClientEnvironment = require ( './env' ) ;
22
23
const paths = require ( './paths' ) ;
23
24
@@ -106,6 +107,14 @@ module.exports = {
106
107
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
107
108
'react-native' : 'react-native-web' ,
108
109
} ,
110
+ plugins : [
111
+ // Prevents users from importing files from outside of src/ (or node_modules/).
112
+ // This often causes confusion because we only process files within src/ with babel.
113
+ // To fix this, we prevent you from importing files out of src/ -- if you'd like to,
114
+ // please link the files into your node_modules/ and let module-resolution kick in.
115
+ // Make sure your source files are compiled, as they will not be processed in any way.
116
+ new ModuleScopePlugin ( paths . appSrc ) ,
117
+ ] ,
109
118
} ,
110
119
module : {
111
120
strictExportPresence : true ,
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin');
18
18
const ManifestPlugin = require ( 'webpack-manifest-plugin' ) ;
19
19
const InterpolateHtmlPlugin = require ( 'react-dev-utils/InterpolateHtmlPlugin' ) ;
20
20
const eslintFormatter = require ( 'react-dev-utils/eslintFormatter' ) ;
21
+ const ModuleScopePlugin = require ( 'react-dev-utils/ModuleScopePlugin' ) ;
21
22
const paths = require ( './paths' ) ;
22
23
const getClientEnvironment = require ( './env' ) ;
23
24
@@ -103,6 +104,14 @@ module.exports = {
103
104
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
104
105
'react-native' : 'react-native-web' ,
105
106
} ,
107
+ plugins : [
108
+ // Prevents users from importing files from outside of src/ (or node_modules/).
109
+ // This often causes confusion because we only process files within src/ with babel.
110
+ // To fix this, we prevent you from importing files out of src/ -- if you'd like to,
111
+ // please link the files into your node_modules/ and let module-resolution kick in.
112
+ // Make sure your source files are compiled, as they will not be processed in any way.
113
+ new ModuleScopePlugin ( paths . appSrc ) ,
114
+ ] ,
106
115
} ,
107
116
module : {
108
117
strictExportPresence : true ,
You can’t perform that action at this time.
0 commit comments