mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
refactor: simplify build.transpile
This commit is contained in:
parent
a888136ac4
commit
13ae634c74
@ -142,14 +142,7 @@ export default class WebpackBaseConfig {
|
||||
exclude: file => {
|
||||
// not exclude files outside node_modules
|
||||
if (/node_modules/.test(file)) {
|
||||
let transpile = this.options.build.transpile || []
|
||||
// transpile supports string like 'vue-lib'
|
||||
if (!Array.isArray(transpile)) {
|
||||
transpile = [transpile]
|
||||
}
|
||||
// include SFCs in node_modules
|
||||
transpile.push(/\.vue\.js/)
|
||||
for (let pkg of transpile) {
|
||||
for (let pkg of this.options.build.transpile) {
|
||||
// item in transpile can be string or regex object
|
||||
if (new RegExp(pkg).test(file)) {
|
||||
return false
|
||||
|
@ -187,5 +187,9 @@ Options.from = function (_options) {
|
||||
if (options.dev) {
|
||||
options.build.extractCSS = false
|
||||
}
|
||||
|
||||
// include SFCs in node_modules
|
||||
options.build.transpile = [/\.vue\.js/].concat(options.build.transpile || [])
|
||||
|
||||
return options
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user