Skip to content

Commit

Permalink
fix: externalize vue-server-renderer + support dynamic import in moch…
Browse files Browse the repository at this point in the history
…a tests
  • Loading branch information
yyx990803 committed Mar 3, 2018
1 parent ee13f7c commit fe9aed8
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion packages/@vue/cli-plugin-unit-mocha/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,23 @@ module.exports = api => {
api.chainWebpack(webpackConfig => {
if (process.env.NODE_ENV === 'test') {
webpackConfig.merge({
target: 'node',
devtool: 'inline-cheap-module-source-map',
externals: [require('webpack-node-externals')()]
externals: [
require('webpack-node-externals')(),
'vue-server-renderer'
]
})

// when target === 'node', vue-loader will attempt to generate
// SSR-optimized code. We need to turn that off here.
webpackConfig.module
.rule('vue')
.use('vue-loader')
.tap(options => {
options.optimizeSSR = false
return options
})
}
})

Expand Down

0 comments on commit fe9aed8

Please sign in to comment.