mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +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 => {
|
exclude: file => {
|
||||||
// not exclude files outside node_modules
|
// not exclude files outside node_modules
|
||||||
if (/node_modules/.test(file)) {
|
if (/node_modules/.test(file)) {
|
||||||
let transpile = this.options.build.transpile || []
|
for (let pkg of 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) {
|
|
||||||
// item in transpile can be string or regex object
|
// item in transpile can be string or regex object
|
||||||
if (new RegExp(pkg).test(file)) {
|
if (new RegExp(pkg).test(file)) {
|
||||||
return false
|
return false
|
||||||
|
@ -187,5 +187,9 @@ Options.from = function (_options) {
|
|||||||
if (options.dev) {
|
if (options.dev) {
|
||||||
options.build.extractCSS = false
|
options.build.extractCSS = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// include SFCs in node_modules
|
||||||
|
options.build.transpile = [/\.vue\.js/].concat(options.build.transpile || [])
|
||||||
|
|
||||||
return options
|
return options
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user