修复打包时缺少static文件夹的问题

This commit is contained in:
Heeexy
2017-12-20 23:12:54 +08:00
parent 688334fead
commit 4d96c538dc
2 changed files with 5 additions and 19 deletions
+4 -18
View File
@@ -11,12 +11,11 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin')
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
function resolve (dir) {
function resolve(dir) {
return path.join(__dirname, '..', dir)
}
const env = require('../config/prod.env')
const webpackConfig = merge(baseWebpackConfig, {
module: {
rules: utils.styleLoaders({
@@ -57,8 +56,8 @@ const webpackConfig = merge(baseWebpackConfig, {
// duplicated CSS from different components can be deduped.
new OptimizeCSSPlugin({
cssProcessorOptions: config.build.productionSourceMap
? { safe: true, map: { inline: false } }
: { safe: true }
? {safe: true, map: {inline: false}}
: {safe: true}
}),
// generate dist index.html with correct asset hash for caching.
// you can customize output by editing /index.html
@@ -86,7 +85,7 @@ const webpackConfig = merge(baseWebpackConfig, {
// split vendor js into its own file
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks (module) {
minChunks(module) {
// any required modules inside node_modules are extracted to vendor
return (
module.resource &&
@@ -112,21 +111,10 @@ const webpackConfig = merge(baseWebpackConfig, {
children: true,
minChunks: 3
}),
// copy custom static assets
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, '../static'),
to: config.build.assetsSubDirectory,
ignore: ['.*']
}
])
]
})
if (config.build.productionGzip) {
const CompressionWebpackPlugin = require('compression-webpack-plugin')
webpackConfig.plugins.push(
new CompressionWebpackPlugin({
asset: '[path].gz[query]',
@@ -141,10 +129,8 @@ if (config.build.productionGzip) {
})
)
}
if (config.build.bundleAnalyzerReport) {
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
webpackConfig.plugins.push(new BundleAnalyzerPlugin())
}
module.exports = webpackConfig
+1 -1
View File
@@ -1,5 +1,5 @@
{
"name": "vue-admin-template",
"name": "vue-admin",
"version": "3.0.0",
"license": "MIT",
"description": "",