fix(webpack): allow files with .cjs extension to be transpiled (#10340)

[release]
This commit is contained in:
Rafał Chłodnicki 2022-06-24 01:07:09 +02:00 committed by GitHub
parent e5efc25940
commit 7a25294c5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -61,7 +61,7 @@ exports[`webpack nuxt webpack module.rules 1`] = `
},
Object {
\\"exclude\\": [Function exclude],
\\"test\\": /\\\\.m?jsx?$/i,
\\"test\\": /\\\\.(c|m)?jsx?$/i,
\\"type\\": \\"javascript/auto\\",
\\"use\\": Array [
Object {
@ -674,7 +674,7 @@ exports[`webpack nuxt webpack module.rules loader=vue- 1`] = `
exports[`webpack nuxt webpack module.rules test=.jsx 1`] = `
"Object {
\\"exclude\\": [Function exclude],
\\"test\\": /\\\\.m?jsx?$/i,
\\"test\\": /\\\\.(c|m)?jsx?$/i,
\\"type\\": \\"javascript/auto\\",
\\"use\\": Array [
Object {

View File

@ -239,7 +239,7 @@ export default class WebpackBaseConfig {
return {
resolve: {
extensions: ['.wasm', '.mjs', '.js', '.json', '.vue', '.jsx'],
extensions: ['.wasm', '.mjs', '.cjs', '.js', '.json', '.vue', '.jsx'],
alias: this.alias(),
modules: webpackModulesDir,
plugins: resolvePlugins
@ -329,7 +329,7 @@ export default class WebpackBaseConfig {
]
},
{
test: /\.m?jsx?$/i,
test: /\.(c|m)?jsx?$/i,
type: 'javascript/auto',
exclude: (file) => {
file = file.split(/node_modules(.*)/)[1]