@@ -4,6 +4,12 @@ const defaults = {
44 entry : 'src/App.vue'
55}
66
7+ const buildModes = {
8+ lib : 'library (commonjs + umd)' ,
9+ wc : 'web component' ,
10+ 'wc-async' : 'web component (async)'
11+ }
12+
713module . exports = ( api , options ) => {
814 api . registerCommand ( 'build' , {
915 description : 'build for production' ,
@@ -42,7 +48,12 @@ module.exports = (api, options) => {
4248 if ( args . target === 'app' ) {
4349 logWithSpinner ( `Building for production...` )
4450 } else {
45- logWithSpinner ( `Building for production as ${ args . target } ...` )
51+ const buildMode = buildModes [ args . target ]
52+ if ( buildMode ) {
53+ logWithSpinner ( `Building for production as ${ buildMode } ...` )
54+ } else {
55+ throw new Error ( `Unknonw build target: ${ args . target } ` )
56+ }
4657 }
4758
4859 return new Promise ( ( resolve , reject ) => {
@@ -55,8 +66,6 @@ module.exports = (api, options) => {
5566 if ( args . target === 'lib' ) {
5667 webpackConfig = require ( './resolveLibConfig' ) ( api , args , options )
5768 } else if (
58- args . target === 'web-component' ||
59- args . target === 'web-component-async' ||
6069 args . target === 'wc' ||
6170 args . target === 'wc-async'
6271 ) {
0 commit comments