fix(webpack): use javascript/auto for js rule (#9180)

This commit is contained in:
Daniel Roe 2021-05-17 19:55:14 +01:00 committed by GitHub
parent db11f7bf93
commit 7955553070
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View File

@ -62,6 +62,7 @@ exports[`webpack nuxt webpack module.rules 1`] = `
Object { Object {
\\"exclude\\": [Function exclude], \\"exclude\\": [Function exclude],
\\"test\\": /\\\\.m?jsx?$/i, \\"test\\": /\\\\.m?jsx?$/i,
\\"type\\": \\"javascript/auto\\",
\\"use\\": Array [ \\"use\\": Array [
Object { Object {
\\"loader\\": \\"<nuxtDir>/node_modules/babel-loader/lib/index.js\\", \\"loader\\": \\"<nuxtDir>/node_modules/babel-loader/lib/index.js\\",
@ -674,6 +675,7 @@ exports[`webpack nuxt webpack module.rules test=.jsx 1`] = `
"Object { "Object {
\\"exclude\\": [Function exclude], \\"exclude\\": [Function exclude],
\\"test\\": /\\\\.m?jsx?$/i, \\"test\\": /\\\\.m?jsx?$/i,
\\"type\\": \\"javascript/auto\\",
\\"use\\": Array [ \\"use\\": Array [
Object { Object {
\\"loader\\": \\"<nuxtDir>/node_modules/babel-loader/lib/index.js\\", \\"loader\\": \\"<nuxtDir>/node_modules/babel-loader/lib/index.js\\",

View File

@ -330,6 +330,7 @@ export default class WebpackBaseConfig {
}, },
{ {
test: /\.m?jsx?$/i, test: /\.m?jsx?$/i,
type: 'javascript/auto',
exclude: (file) => { exclude: (file) => {
file = file.split(/node_modules(.*)/)[1] file = file.split(/node_modules(.*)/)[1]