mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 09:27: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
|
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) {
|
||||||
|
@ -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 }
|
||||||
|
@ -86,16 +86,18 @@ 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
|
||||||
this.options.modulesDir.forEach((dir) => {
|
if (!this.options.build.standalone && !this.options.dev) {
|
||||||
if (fs.existsSync(dir)) {
|
this.options.modulesDir.forEach((dir) => {
|
||||||
config.externals.push(
|
if (fs.existsSync(dir)) {
|
||||||
nodeExternals({
|
config.externals.push(
|
||||||
whitelist: this.whitelist,
|
nodeExternals({
|
||||||
modulesDir: dir
|
whitelist: this.whitelist,
|
||||||
})
|
modulesDir: dir
|
||||||
)
|
})
|
||||||
}
|
)
|
||||||
})
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user