mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
feat(webpack,cli): standalone build mode (#4661)
* feat(webpack,cli): standalone build mode * revert typo
This commit is contained in:
parent
a4c503bfbb
commit
bdb6791e40
@ -46,6 +46,16 @@ export default {
|
||||
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) {
|
||||
|
@ -10,6 +10,7 @@ export default () => ({
|
||||
ssr: undefined,
|
||||
parallel: false,
|
||||
cache: false,
|
||||
standalone: false,
|
||||
publicPath: '/_nuxt/',
|
||||
filenames: {
|
||||
// { isDev, isClient, isServer }
|
||||
|
@ -86,16 +86,18 @@ export default class WebpackServerConfig extends WebpackBaseConfig {
|
||||
// https://webpack.js.org/configuration/externals/#externals
|
||||
// https://github.com/liady/webpack-node-externals
|
||||
// https://vue-loader.vuejs.org/migrating.html#ssr-externals
|
||||
this.options.modulesDir.forEach((dir) => {
|
||||
if (fs.existsSync(dir)) {
|
||||
config.externals.push(
|
||||
nodeExternals({
|
||||
whitelist: this.whitelist,
|
||||
modulesDir: dir
|
||||
})
|
||||
)
|
||||
}
|
||||
})
|
||||
if (!this.options.build.standalone && !this.options.dev) {
|
||||
this.options.modulesDir.forEach((dir) => {
|
||||
if (fs.existsSync(dir)) {
|
||||
config.externals.push(
|
||||
nodeExternals({
|
||||
whitelist: this.whitelist,
|
||||
modulesDir: dir
|
||||
})
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return config
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user