File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 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');
1818const InterpolateHtmlPlugin = require ( 'react-dev-utils/InterpolateHtmlPlugin' ) ;
1919const WatchMissingNodeModulesPlugin = require ( 'react-dev-utils/WatchMissingNodeModulesPlugin' ) ;
2020const eslintFormatter = require ( 'react-dev-utils/eslintFormatter' ) ;
21+ const ModuleScopePlugin = require ( 'react-dev-utils/ModuleScopePlugin' ) ;
2122const getClientEnvironment = require ( './env' ) ;
2223const paths = require ( './paths' ) ;
2324
@@ -106,6 +107,14 @@ module.exports = {
106107 // https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
107108 'react-native' : 'react-native-web' ,
108109 } ,
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+ ] ,
109118 } ,
110119 module : {
111120 strictExportPresence : true ,
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin');
1818const ManifestPlugin = require ( 'webpack-manifest-plugin' ) ;
1919const InterpolateHtmlPlugin = require ( 'react-dev-utils/InterpolateHtmlPlugin' ) ;
2020const eslintFormatter = require ( 'react-dev-utils/eslintFormatter' ) ;
21+ const ModuleScopePlugin = require ( 'react-dev-utils/ModuleScopePlugin' ) ;
2122const paths = require ( './paths' ) ;
2223const getClientEnvironment = require ( './env' ) ;
2324
@@ -103,6 +104,14 @@ module.exports = {
103104 // https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
104105 'react-native' : 'react-native-web' ,
105106 } ,
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+ ] ,
106115 } ,
107116 module : {
108117 strictExportPresence : true ,
You can’t perform that action at this time.
0 commit comments