feat(webpack,cli): standalone build mode (#4661)

* feat(webpack,cli): standalone build mode

* revert typo
This commit is contained in:
Pooya Parsa 2019-01-03 23:57:50 +03:30 committed by GitHub
parent a4c503bfbb
commit bdb6791e40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 10 deletions

View File

@ -46,6 +46,16 @@ export default {
options.build.quiet = !!argv.quiet options.build.quiet = !!argv.quiet
} }
} }
},
standalone: {
type: 'boolean',
default: false,
description: 'Bundle all server dependencies (useful for nuxt-start)',
prepare(cmd, options, argv) {
if (argv.standalone) {
options.build.standalone = true
}
}
} }
}, },
async run(cmd) { async run(cmd) {

View File

@ -10,6 +10,7 @@ export default () => ({
ssr: undefined, ssr: undefined,
parallel: false, parallel: false,
cache: false, cache: false,
standalone: false,
publicPath: '/_nuxt/', publicPath: '/_nuxt/',
filenames: { filenames: {
// { isDev, isClient, isServer } // { isDev, isClient, isServer }

View File

@ -86,6 +86,7 @@ export default class WebpackServerConfig extends WebpackBaseConfig {
// https://webpack.js.org/configuration/externals/#externals // https://webpack.js.org/configuration/externals/#externals
// https://github.com/liady/webpack-node-externals // https://github.com/liady/webpack-node-externals
// https://vue-loader.vuejs.org/migrating.html#ssr-externals // https://vue-loader.vuejs.org/migrating.html#ssr-externals
if (!this.options.build.standalone && !this.options.dev) {
this.options.modulesDir.forEach((dir) => { this.options.modulesDir.forEach((dir) => {
if (fs.existsSync(dir)) { if (fs.existsSync(dir)) {
config.externals.push( config.externals.push(
@ -96,6 +97,7 @@ export default class WebpackServerConfig extends WebpackBaseConfig {
) )
} }
}) })
}
return config return config
} }