Skip to content

Commit a19ef80

Browse files
authored
Toggle mjs files to javascript/auto type (facebook#5151)
1 parent 6e97c1a commit a19ef80

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

config/webpack.config.dev.js

+10
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,16 @@ module.exports = {
187187
],
188188
include: paths.appSrc,
189189
},
190+
{
191+
// `mjs` support is still in its infancy in the ecosystem, so we don't
192+
// support it.
193+
// Modules who define their `browser` or `module` key as `mjs` force
194+
// the use of this extension, so we need to tell webpack to fall back
195+
// to auto mode (ES Module interop, allows ESM to import CommonJS).
196+
test: /\.mjs$/,
197+
include: /node_modules/,
198+
type: 'javascript/auto',
199+
},
190200
{
191201
// "oneOf" will traverse all following loaders until one will
192202
// match the requirements. When no loader matches it will fall

config/webpack.config.prod.js

+10
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,16 @@ module.exports = {
244244
],
245245
include: paths.appSrc,
246246
},
247+
{
248+
// `mjs` support is still in its infancy in the ecosystem, so we don't
249+
// support it.
250+
// Modules who define their `browser` or `module` key as `mjs` force
251+
// the use of this extension, so we need to tell webpack to fall back
252+
// to auto mode (ES Module interop, allows ESM to import CommonJS).
253+
test: /\.mjs$/,
254+
include: /node_modules/,
255+
type: 'javascript/auto',
256+
},
247257
{
248258
// "oneOf" will traverse all following loaders until one will
249259
// match the requirements. When no loader matches it will fall

0 commit comments

Comments
 (0)