Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b5e62a6

Browse files
Revert: remove prod config
1 parent 965eaa1 commit b5e62a6

File tree

4 files changed

+26
-5
lines changed

4 files changed

+26
-5
lines changed

build/webpack.base.conf.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@ var projectRoot = path.resolve(__dirname, '../')
66
var env = process.env.NODE_ENV
77
// check env & config/index.js to decide whether to enable CSS source maps for the
88
// various preprocessor loaders added to vue-loader at the end of this file
9-
var useCssSourceMap = (env === 'development' && config.dev.cssSourceMap)
9+
var cssSourceMapDev = (env === 'development' && config.dev.cssSourceMap)
10+
var cssSourceMapProd = (env === 'production' && config.build.productionSourceMap)
11+
var useCssSourceMap = cssSourceMapDev || cssSourceMapProd
1012

1113
module.exports = {
1214
entry: {
1315
app: './src/main.js'
1416
},
1517
output: {
16-
path: config.dev.assetsPublicPath,
17-
publicPath: config.dev.assetsPublicPath,
18+
path: config.build.assetsRoot,
19+
publicPath: process.env.NODE_ENV === 'production' ? config.build.assetsPublicPath : config.dev.assetsPublicPath,
1820
filename: '[name].js'
1921
},
2022
resolve: {

config/dev.env.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
var merge = require('webpack-merge')
2-
module.exports = {
2+
var prodEnv = require('./prod.env')
3+
4+
module.exports = merge(prodEnv, {
35
NODE_ENV: '"development"'
4-
}
6+
})

config/index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@
22
var path = require('path')
33

44
module.exports = {
5+
build: {
6+
env: require('./prod.env'),
7+
index: path.resolve(__dirname, '../dist/index.html'),
8+
assetsRoot: path.resolve(__dirname, '../dist'),
9+
assetsSubDirectory: 'static',
10+
assetsPublicPath: '/',
11+
productionSourceMap: true,
12+
// Gzip off by default as many popular static hosts such as
13+
// Surge or Netlify already gzip all static assets for you.
14+
// Before setting to `true`, make sure to:
15+
// npm install --save-dev compression-webpack-plugin
16+
productionGzip: false,
17+
productionGzipExtensions: ['js', 'css']
18+
},
519
dev: {
620
env: require('./dev.env'),
721
port: 8080,

config/prod.env.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
NODE_ENV: '"production"'
3+
}

0 commit comments

Comments
 (0)