Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from Jun 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/cli/test/unit/__snapshots__/webpack.test.js.snap
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions packages/webpack/src/config/base.js
Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand Down