11// vue.config.js
22let CopyWebpackPlugin = require ( 'copy-webpack-plugin' )
3+ let FileManagerPlugin = require ( 'filemanager-webpack-plugin' ) ;
34let path = require ( 'path' )
5+ let fs = require ( 'fs' ) ;
6+
7+ const getVersion = ( ) => {
8+ const pkgPath = path . join ( __dirname , './package.json' ) ;
9+ let pkg = fs . readFileSync ( pkgPath ) ;
10+ pkg = JSON . parse ( pkg ) ;
11+ return pkg . version ;
12+ }
13+
414module . exports = {
15+ outputDir : 'dist/dist' ,
16+ chainWebpack : ( config ) => {
17+ if ( process . env . NODE_ENV === 'production' ) {
18+ config . plugin ( 'compress' ) . use ( FileManagerPlugin , [ {
19+ onEnd : {
20+ copy : [
21+ { source : 'node_modules/monaco-editor/dev/vs' , destination : `./dist/dist/static/vs` } ,
22+ { source : './config.sh' , destination : `./dist` } ,
23+ { source : './install.sh' , destination : `./dist` }
24+ ] ,
25+ // 先删除根目录下的zip包
26+ delete : [ `./wedatasphere-scriptis-${ getVersion ( ) } -dist.zip` ] ,
27+ // 将dist文件夹下的文件进行打包
28+ archive : [
29+ { source : './dist' , destination : `./wedatasphere-scriptis-${ getVersion ( ) } -dist.zip` } ,
30+ ]
31+ } ,
32+ } ] )
33+ }
34+ } ,
535 configureWebpack : {
636 resolve : {
737 alias : {
@@ -12,8 +42,6 @@ module.exports = {
1242 }
1343 } ,
1444 plugins : [
15- // 忽略moment的locale文件夹,然后再main.js中手动加载 ‘moment/locale/zh-cn'
16- // new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)
1745 new CopyWebpackPlugin ( [ {
1846 from : 'node_modules/monaco-editor/dev/vs' ,
1947 to : 'static/vs' ,
@@ -27,4 +55,4 @@ module.exports = {
2755 power : false
2856 }
2957 }
30- }
58+ }
0 commit comments