@@ -24,6 +24,7 @@ module.exports = (api, options) => {
24
24
options : {
25
25
'--mode' : `specify env mode (default: production)` ,
26
26
'--dest' : `specify output directory (default: ${ options . outputDir } )` ,
27
+ '--modern' : `build app targeting modern browsers with auto fallback` ,
27
28
'--target' : `app | lib | wc | wc-async (default: ${ defaults . target } )` ,
28
29
'--name' : `name for lib or web-component mode (default: "name" in package.json or entry filename)` ,
29
30
'--no-clean' : `do not remove the dist directory before building the project` ,
@@ -42,17 +43,20 @@ module.exports = (api, options) => {
42
43
args . entry = args . entry || 'src/App.vue'
43
44
}
44
45
45
- if ( options . modernMode && args . target === 'app' ) {
46
+ if ( args . modern && args . target === 'app' ) {
47
+ process . env . VUE_CLI_MODERN_MODE = true
46
48
delete process . env . VUE_CLI_MODERN_BUILD
47
49
await build ( Object . assign ( { } , args , {
48
- modern : false
50
+ modernBuild : false
49
51
} ) , api , options )
50
52
51
53
process . env . VUE_CLI_MODERN_BUILD = true
52
54
await build ( Object . assign ( { } , args , {
53
- modern : true ,
55
+ modernBuild : true ,
54
56
clean : false
55
57
} ) , api , options )
58
+
59
+ delete process . env . VUE_CLI_MODERN_MODE
56
60
delete process . env . VUE_CLI_MODERN_BUILD
57
61
} else {
58
62
return build ( args , api , options )
@@ -77,8 +81,8 @@ async function build (args, api, options) {
77
81
log ( )
78
82
const mode = api . service . mode
79
83
if ( args . target === 'app' ) {
80
- const bundleTag = options . modernMode
81
- ? args . modern
84
+ const bundleTag = args . modern
85
+ ? args . modernBuild
82
86
? `modern bundle `
83
87
: `legacy bundle `
84
88
: ``
@@ -93,7 +97,7 @@ async function build (args, api, options) {
93
97
}
94
98
95
99
const targetDir = api . resolve ( args . dest || options . outputDir )
96
- const isLegacyBuild = args . target === 'app' && options . modernMode && ! args . modern
100
+ const isLegacyBuild = args . target === 'app' && args . modern && ! args . modernBuild
97
101
98
102
// resolve raw webpack config
99
103
process . env . VUE_CLI_BUILD_TARGET = args . target
0 commit comments