diff --git a/packages/cli/test/unit/__snapshots__/webpack.test.js.snap b/packages/cli/test/unit/__snapshots__/webpack.test.js.snap index 8f2278dc36..d0ffed3e40 100644 --- a/packages/cli/test/unit/__snapshots__/webpack.test.js.snap +++ b/packages/cli/test/unit/__snapshots__/webpack.test.js.snap @@ -62,6 +62,7 @@ exports[`webpack nuxt webpack module.rules 1`] = ` Object { \\"exclude\\": [Function exclude], \\"test\\": /\\\\.m?jsx?$/i, + \\"type\\": \\"javascript/auto\\", \\"use\\": Array [ Object { \\"loader\\": \\"/node_modules/babel-loader/lib/index.js\\", @@ -674,6 +675,7 @@ exports[`webpack nuxt webpack module.rules test=.jsx 1`] = ` "Object { \\"exclude\\": [Function exclude], \\"test\\": /\\\\.m?jsx?$/i, + \\"type\\": \\"javascript/auto\\", \\"use\\": Array [ Object { \\"loader\\": \\"/node_modules/babel-loader/lib/index.js\\", diff --git a/packages/webpack/src/config/base.js b/packages/webpack/src/config/base.js index eedf61600a..73d35b6df5 100644 --- a/packages/webpack/src/config/base.js +++ b/packages/webpack/src/config/base.js @@ -330,6 +330,7 @@ export default class WebpackBaseConfig { }, { test: /\.m?jsx?$/i, + type: 'javascript/auto', exclude: (file) => { file = file.split(/node_modules(.*)/)[1]