diff --git a/.env.development b/.env.development index c8765073..002371a0 100644 --- a/.env.development +++ b/.env.development @@ -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() diff --git a/.env.production b/.env.production index 1d2d6c9f..6823bd93 100644 --- a/.env.production +++ b/.env.production @@ -1 +1 @@ -VUE_APP_BASE_API = '/api' +VUE_APP_BASE_API = '/api-prod' diff --git a/.env.sit b/.env.sit new file mode 100644 index 00000000..81839fe2 --- /dev/null +++ b/.env.sit @@ -0,0 +1,2 @@ +NODE_ENV=production +VUE_APP_BASE_API = '/api-sit' diff --git a/package.json b/package.json index a5f917eb..0c2b1656 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/vue.config.js b/vue.config.js index 5d169522..4a9c12b2 100644 --- a/vue.config.js +++ b/vue.config.js @@ -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',