1
- const webpack = require ( 'webpack' )
2
- const formatStats = require ( '@vue/cli-service/lib/commands/build/formatStats' )
3
- const rimraf = require ( 'rimraf' )
4
-
5
- const { getWebpackConfig } = require ( './lib/webpack' )
6
- const { createServer } = require ( './lib/server' )
7
1
const config = require ( './lib/config' )
8
2
const defaultConfig = require ( './lib/default-config' )
9
3
@@ -22,10 +16,15 @@ module.exports = (api, options) => {
22
16
api . registerCommand ( 'ssr:build' , {
23
17
description : 'build for production (SSR)' ,
24
18
} , async ( args ) => {
19
+ const webpack = require ( 'webpack' )
20
+ const rimraf = require ( 'rimraf' )
21
+ const formatStats = require ( '@vue/cli-service/lib/commands/build/formatStats' )
22
+
25
23
const options = service . projectOptions
26
24
27
25
rimraf . sync ( api . resolve ( config . distPath ) )
28
26
27
+ const { getWebpackConfig } = require ( './lib/webpack' )
29
28
const clientConfig = getWebpackConfig ( { service, target : 'client' } )
30
29
const serverConfig = getWebpackConfig ( { service, target : 'server' } )
31
30
@@ -72,6 +71,8 @@ module.exports = (api, options) => {
72
71
'-h, --host [host]' : 'specify host' ,
73
72
} ,
74
73
} , async ( args ) => {
74
+ const { createServer } = require ( './lib/server' )
75
+
75
76
let port = args . port || config . port || process . env . PORT
76
77
if ( ! port ) {
77
78
const portfinder = require ( 'portfinder' )
@@ -94,4 +95,3 @@ module.exports.defaultModes = {
94
95
'ssr:build' : 'production' ,
95
96
'ssr:server' : 'development' ,
96
97
}
97
-
0 commit comments