@@ -24,6 +24,7 @@ module.exports = (api, options) => {
2424 options : {
2525 '--mode' : `specify env mode (default: production)` ,
2626 '--dest' : `specify output directory (default: ${ options . outputDir } )` ,
27+ '--modern' : `build app targeting modern browsers with auto fallback` ,
2728 '--target' : `app | lib | wc | wc-async (default: ${ defaults . target } )` ,
2829 '--name' : `name for lib or web-component mode (default: "name" in package.json or entry filename)` ,
2930 '--no-clean' : `do not remove the dist directory before building the project` ,
@@ -42,17 +43,20 @@ module.exports = (api, options) => {
4243 args . entry = args . entry || 'src/App.vue'
4344 }
4445
45- if ( options . modernMode && args . target === 'app' ) {
46+ if ( args . modern && args . target === 'app' ) {
47+ process . env . VUE_CLI_MODERN_MODE = true
4648 delete process . env . VUE_CLI_MODERN_BUILD
4749 await build ( Object . assign ( { } , args , {
48- modern : false
50+ modernBuild : false
4951 } ) , api , options )
5052
5153 process . env . VUE_CLI_MODERN_BUILD = true
5254 await build ( Object . assign ( { } , args , {
53- modern : true ,
55+ modernBuild : true ,
5456 clean : false
5557 } ) , api , options )
58+
59+ delete process . env . VUE_CLI_MODERN_MODE
5660 delete process . env . VUE_CLI_MODERN_BUILD
5761 } else {
5862 return build ( args , api , options )
@@ -77,8 +81,8 @@ async function build (args, api, options) {
7781 log ( )
7882 const mode = api . service . mode
7983 if ( args . target === 'app' ) {
80- const bundleTag = options . modernMode
81- ? args . modern
84+ const bundleTag = args . modern
85+ ? args . modernBuild
8286 ? `modern bundle `
8387 : `legacy bundle `
8488 : ``
@@ -93,7 +97,7 @@ async function build (args, api, options) {
9397 }
9498
9599 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
97101
98102 // resolve raw webpack config
99103 process . env . VUE_CLI_BUILD_TARGET = args . target
0 commit comments