File tree 2 files changed +28
-2
lines changed
2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -159,7 +159,8 @@ module.exports = {
159
159
name : 'static/media/[name].[hash:8].[ext]' ,
160
160
} ,
161
161
} ,
162
- // Process JS with Babel.
162
+ // Process application JS with Babel.
163
+ // The preset includes JSX, Flow, and some ESnext features.
163
164
{
164
165
test : / \. ( j s | j s x | m j s ) $ / ,
165
166
include : paths . appSrc ,
@@ -175,6 +176,18 @@ module.exports = {
175
176
cacheDirectory : true ,
176
177
} ,
177
178
} ,
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
+ } ,
178
191
// "postcss" loader applies autoprefixer to our CSS.
179
192
// "css" loader resolves paths in CSS and adds assets as dependencies.
180
193
// "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 = {
167
167
name : 'static/media/[name].[hash:8].[ext]' ,
168
168
} ,
169
169
} ,
170
- // Process JS with Babel.
170
+ // Process application JS with Babel.
171
+ // The preset includes JSX, Flow, and some ESnext features.
171
172
{
172
173
test : / \. ( j s | j s x | m j s ) $ / ,
173
174
include : paths . appSrc ,
@@ -180,6 +181,18 @@ module.exports = {
180
181
compact : true ,
181
182
} ,
182
183
} ,
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
+ } ,
183
196
// The notation here is somewhat confusing.
184
197
// "postcss" loader applies autoprefixer to our CSS.
185
198
// "css" loader resolves paths in CSS and adds assets as dependencies.
You can’t perform that action at this time.
0 commit comments