@@ -144,7 +144,7 @@ module.exports = {
144
144
// https://github.com/facebook/create-react-app/issues/290
145
145
// `web` extension prefixes have been added for better support
146
146
// for React Native Web.
147
- extensions : [ '.web.js' , '.js' , '.json' , '.web.jsx' , '.jsx' ] ,
147
+ extensions : [ '.mjs' , '. web.js', '.js' , '.json' , '.web.jsx' , '.jsx' ] ,
148
148
alias : {
149
149
// Support React Native Web
150
150
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
@@ -178,7 +178,7 @@ module.exports = {
178
178
// First, run the linter.
179
179
// It's important to do this before Babel processes the JS.
180
180
{
181
- test : / \. ( j s | j s x ) $ / ,
181
+ test : / \. ( j s | m j s | j s x ) $ / ,
182
182
enforce : 'pre' ,
183
183
use : [
184
184
{
@@ -199,16 +199,6 @@ module.exports = {
199
199
] ,
200
200
include : paths . appSrc ,
201
201
} ,
202
- {
203
- // `mjs` support is still in its infancy in the ecosystem, so we don't
204
- // support it.
205
- // Modules who define their `browser` or `module` key as `mjs` force
206
- // the use of this extension, so we need to tell webpack to fall back
207
- // to auto mode (ES Module interop, allows ESM to import CommonJS).
208
- test : / \. m j s $ / ,
209
- include : / n o d e _ m o d u l e s / ,
210
- type : 'javascript/auto' ,
211
- } ,
212
202
{
213
203
// "oneOf" will traverse all following loaders until one will
214
204
// match the requirements. When no loader matches it will fall
@@ -228,7 +218,7 @@ module.exports = {
228
218
// Process application JS with Babel.
229
219
// The preset includes JSX, Flow, and some ESnext features.
230
220
{
231
- test : / \. ( j s | j s x ) $ / ,
221
+ test : / \. ( j s | m j s | j s x ) $ / ,
232
222
include : paths . appSrc ,
233
223
loader : require . resolve ( 'babel-loader' ) ,
234
224
options : {
@@ -274,7 +264,7 @@ module.exports = {
274
264
// Process any JS outside of the app with Babel.
275
265
// Unlike the application JS, we only compile the standard ES features.
276
266
{
277
- test : / \. j s $ / ,
267
+ test : / \. ( j s | m j s ) $ / ,
278
268
exclude : / @ b a b e l (?: \/ | \\ { 1 , 2 } ) r u n t i m e / ,
279
269
loader : require . resolve ( 'babel-loader' ) ,
280
270
options : {
@@ -361,7 +351,7 @@ module.exports = {
361
351
// its runtime that would otherwise be processed through "file" loader.
362
352
// Also exclude `html` and `json` extensions so they get processed
363
353
// by webpacks internal loaders.
364
- exclude : [ / \. ( j s | j s x ) $ / , / \. h t m l $ / , / \. j s o n $ / ] ,
354
+ exclude : [ / \. ( j s | m j s | j s x ) $ / , / \. h t m l $ / , / \. j s o n $ / ] ,
365
355
loader : require . resolve ( 'file-loader' ) ,
366
356
options : {
367
357
name : 'static/media/[name].[hash:8].[ext]' ,
0 commit comments