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 => { exclude: file => {
// not exclude files outside node_modules // not exclude files outside node_modules
if (/node_modules/.test(file)) { 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 // item in transpile can be string or regex object
if (new RegExp(pkg).test(file)) { if (module.test(file)) {
return false return false
} }
} }

View File

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

View File

@ -192,7 +192,8 @@ Options.from = function (_options) {
} }
// include SFCs in node_modules // 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 return options
} }