update config

This commit is contained in:
Pan 2019-03-11 16:29:59 +08:00
parent 1dfea3b287
commit 653de1f31e
5 changed files with 17 additions and 12 deletions

View File

@ -1,4 +1,4 @@
VUE_APP_BASE_API = '/api'
VUE_APP_BASE_API = '/api-dev'
// With this configuration, vue-cli uses babel-plugin-dynamic-import-node
// It only does one thing by converting all import() to require()

View File

@ -1 +1 @@
VUE_APP_BASE_API = '/api'
VUE_APP_BASE_API = '/api-prod'

2
.env.sit Normal file
View File

@ -0,0 +1,2 @@
NODE_ENV=production
VUE_APP_BASE_API = '/api-sit'

View File

@ -7,7 +7,7 @@
"scripts": {
"dev": "vue-cli-service serve",
"build:prod": "vue-cli-service build",
"build:sit": "vue-cli-service build --mode text",
"build:sit": "vue-cli-service build --mode sit",
"build:preview": "node build/index.js --preview",
"build:report": "node build/index.js --report",
"lint": "eslint --ext .js,.vue src",

View File

@ -5,7 +5,9 @@ function resolve(dir) {
return path.join(__dirname, dir)
}
const port = 9527 // TODO: change to Settings
// TODO: change to Settings
const port = 9527
const name = 'vue-element-admin'
// Explanation of each configuration item You can find it in https://cli.vuejs.org/config/
module.exports = {
@ -20,7 +22,7 @@ module.exports = {
publicPath: '/',
outputDir: 'dist',
assetsDir: 'static',
lintOnSave: process.env.NODE_ENV !== 'production',
lintOnSave: process.env.NODE_ENV === 'development' ? 'error' : false,
productionSourceMap: false,
devServer: {
port: port,
@ -39,7 +41,6 @@ module.exports = {
}
},
after(app) {
console.log('apple')
const bodyParser = require('body-parser')
require('@babel/register')
// parse app.body
@ -59,7 +60,7 @@ module.exports = {
configureWebpack: {
// We provide the app's title in Webpack's name field, so that
// it can be accessed in index.html to inject the correct title.
name: 'vue-element-admin', // TODO: change to Settings
name: name,
resolve: {
alias: {
'@': resolve('src')
@ -102,11 +103,13 @@ module.exports = {
.when(process.env.NODE_ENV !== 'development',
config => {
config
.plugin('ScriptExtHtmlWebpackPlugin')
.use('script-ext-html-webpack-plugin', [{
// `runtime` must same as runtimeChunk name. default is `runtime`
inline: /runtime\..*\.js$/
}])
// .plugin('ScriptExtHtmlWebpackPlugin')
// .after('html')
// .use('script-ext-html-webpack-plugin', [{
// // `runtime` must same as runtimeChunk name. default is `runtime`
// inline: /runtime\..*\.js$/
// }])
// .end()
config
.optimization.splitChunks({
chunks: 'all',