Skip to content

Commit 6fd8ca4

Browse files
committed
生产环境代码增加 README,package.json 的拷贝
1 parent 4cc017a commit 6fd8ca4

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

build/webpack.prod.conf.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ var ExtractTextPlugin = require('extract-text-webpack-plugin')
1010
var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
1111

1212
var isDist = !!process.env.DIST_ENV
13+
var distPath = './dist'
1314

1415
var env = process.env.NODE_ENV === 'testing'
1516
? require('../config/test.env')
@@ -38,7 +39,13 @@ var webpackConfig = merge(baseWebpackConfig, {
3839
warnings: false
3940
},
4041
sourceMap: config.build.productionSourceMap
41-
})
42+
}),
43+
new CopyWebpackPlugin([
44+
{
45+
from: path.resolve(__dirname, '../README.md'),
46+
to: isDist ? distPath : config.build.assetsRoot
47+
}
48+
])
4249
]
4350
})
4451

@@ -47,10 +54,18 @@ if (isDist) {
4754
'vue-json-pretty': './src/index.js'
4855
}
4956
webpackConfig.output = {
50-
filename: './dist/[name].js',
57+
filename: `${distPath}/[name].js`,
5158
library: 'VueJsonPretty',
5259
libraryTarget: 'umd'
5360
}
61+
webpackConfig.plugins.push(
62+
new CopyWebpackPlugin([
63+
{
64+
from: path.resolve(__dirname, '../package.json'),
65+
to: distPath
66+
}
67+
])
68+
)
5469
} else {
5570
webpackConfig.plugins.push(
5671
// extract css into its own file

0 commit comments

Comments
 (0)