File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -159,7 +159,8 @@ module.exports = {
159159 name : 'static/media/[name].[hash:8].[ext]' ,
160160 } ,
161161 } ,
162- // Process JS with Babel.
162+ // Process application JS with Babel.
163+ // The preset includes JSX, Flow, and some ESnext features.
163164 {
164165 test : / \. ( j s | j s x | m j s ) $ / ,
165166 include : paths . appSrc ,
@@ -175,6 +176,18 @@ module.exports = {
175176 cacheDirectory : true ,
176177 } ,
177178 } ,
179+ // Process any JS outside of the app with Babel.
180+ // Unlike the application JS, we only compile the standard ES features.
181+ {
182+ test : / \. j s $ / ,
183+ loader : require . resolve ( 'babel-loader' ) ,
184+ options : {
185+ babelrc : false ,
186+ compact : false ,
187+ presets : [ require . resolve ( 'babel-preset-react-app/dependencies' ) ] ,
188+ cacheDirectory : true ,
189+ } ,
190+ } ,
178191 // "postcss" loader applies autoprefixer to our CSS.
179192 // "css" loader resolves paths in CSS and adds assets as dependencies.
180193 // "style" loader turns CSS into JS modules that inject <style> tags.
Original file line number Diff line number Diff line change @@ -167,7 +167,8 @@ module.exports = {
167167 name : 'static/media/[name].[hash:8].[ext]' ,
168168 } ,
169169 } ,
170- // Process JS with Babel.
170+ // Process application JS with Babel.
171+ // The preset includes JSX, Flow, and some ESnext features.
171172 {
172173 test : / \. ( j s | j s x | m j s ) $ / ,
173174 include : paths . appSrc ,
@@ -180,6 +181,18 @@ module.exports = {
180181 compact : true ,
181182 } ,
182183 } ,
184+ // Process any JS outside of the app with Babel.
185+ // Unlike the application JS, we only compile the standard ES features.
186+ {
187+ test : / \. j s $ / ,
188+ loader : require . resolve ( 'babel-loader' ) ,
189+ options : {
190+ babelrc : false ,
191+ compact : false ,
192+ presets : [ require . resolve ( 'babel-preset-react-app/dependencies' ) ] ,
193+ cacheDirectory : true ,
194+ } ,
195+ } ,
183196 // The notation here is somewhat confusing.
184197 // "postcss" loader applies autoprefixer to our CSS.
185198 // "css" loader resolves paths in CSS and adds assets as dependencies.
You can’t perform that action at this time.
0 commit comments