Skip to content

Commit bd335a9

Browse files
committed
also compile mjs files
1 parent e00da6b commit bd335a9

File tree

2 files changed

+2
-21
lines changed

2 files changed

+2
-21
lines changed

packages/gatsby/src/utils/webpack-utils.js

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -295,34 +295,16 @@ module.exports = async ({
295295
{
296296
let js = (options = {}) => {
297297
return {
298-
test: /\.jsx?$/,
298+
test: /\.(js|mjs|jsx)$/,
299299
exclude: /core-js|event-source-polyfill|webpack-hot-middleware\/client/,
300+
type: `javascript/auto`,
300301
use: [loaders.js(options)],
301302
}
302303
}
303304

304305
rules.js = js
305306
}
306307

307-
/**
308-
* mjs loader:
309-
* webpack 4 has issues automatically dealing with
310-
* the .mjs extension, thus we need to explicitly
311-
* add this rule to use the default webpack js loader
312-
*/
313-
{
314-
let mjs = (options = {}) => {
315-
return {
316-
test: /\.mjs$/,
317-
include: /node_modules/,
318-
type: `javascript/auto`,
319-
...options,
320-
}
321-
}
322-
323-
rules.mjs = mjs
324-
}
325-
326308
{
327309
let eslint = schema => {
328310
return {

packages/gatsby/src/utils/webpack.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,6 @@ module.exports = async (program, directory, suppliedStage) => {
249249
// Common config for every env.
250250
// prettier-ignore
251251
let configRules = [
252-
rules.mjs(),
253252
rules.js(),
254253
rules.yaml(),
255254
rules.fonts(),

0 commit comments

Comments
 (0)