feat: exclude build.transpile in server node externals (#3614)

This commit is contained in:
Clark Du 2018-07-31 14:10:24 +01:00 committed by Sébastien Chopin
parent 8c54c6d577
commit 56db988f27
3 changed files with 6 additions and 4 deletions

View File

@ -142,9 +142,9 @@ export default class WebpackBaseConfig {
exclude: file => {
// not exclude files outside node_modules
if (/node_modules/.test(file)) {
for (let pkg of this.options.build.transpile) {
for (let module of [/\.vue\.js/].concat(this.options.build.transpile)) {
// item in transpile can be string or regex object
if (new RegExp(pkg).test(file)) {
if (module.test(file)) {
return false
}
}

View File

@ -67,7 +67,8 @@ export default class WebpackServerConfig extends BaseConfig {
whitelist: [
/es6-promise|\.(?!(?:js|json)$).{1,5}$/i,
/\.css$/,
/\?vue&type=style/
/\?vue&type=style/,
...this.options.build.transpile
],
modulesDir: dir
})

View File

@ -192,7 +192,8 @@ Options.from = function (_options) {
}
// include SFCs in node_modules
options.build.transpile = [/\.vue\.js/].concat(options.build.transpile || [])
options.build.transpile = [].concat(options.build.transpile || [])
.map(module => module instanceof RegExp ? module : new RegExp(module))
return options
}