|
@@ -1,22 +1,22 @@
|
|
|
-'use strict'
|
|
|
-const path = require('path')
|
|
|
-const defaultSettings = require('./src/settings.js')
|
|
|
+
|
|
|
+const path = require('path');
|
|
|
+const defaultSettings = require('./src/settings.js');
|
|
|
const CompressionPlugin = require('compression-webpack-plugin');
|
|
|
|
|
|
function resolve(dir) {
|
|
|
- return path.join(__dirname, dir)
|
|
|
+ return path.join(__dirname, dir);
|
|
|
}
|
|
|
|
|
|
-const name = defaultSettings.title || '发展汉语' // page title
|
|
|
+const name = defaultSettings.title || '发展汉语'; // page title
|
|
|
|
|
|
// If your port is set to 80,
|
|
|
// use administrator privileges to execute the command line.
|
|
|
// For example, Mac: sudo npm run
|
|
|
// You can change the port by the following methods:
|
|
|
// port = 9528 npm run dev OR npm run dev --port = 9528
|
|
|
-const port = process.env.port || process.env.npm_config_port || 9560 // dev port
|
|
|
+const port = process.env.port || process.env.npm_config_port || 9560; // dev port
|
|
|
|
|
|
-const webpack = require('webpack')
|
|
|
+const webpack = require('webpack');
|
|
|
|
|
|
// All configuration item explanations can be find in https://cli.vuejs.org/config/
|
|
|
module.exports = {
|
|
@@ -33,7 +33,7 @@ module.exports = {
|
|
|
lintOnSave: false,
|
|
|
productionSourceMap: false,
|
|
|
devServer: {
|
|
|
- port: port,
|
|
|
+ port,
|
|
|
open: true,
|
|
|
overlay: {
|
|
|
warnings: false,
|
|
@@ -44,20 +44,28 @@ module.exports = {
|
|
|
// detail: https://cli.vuejs.org/config/#devserver-proxy
|
|
|
[process.env.VUE_APP_BASE_API]: {
|
|
|
target: `http://gcls.utschool.cn/`,
|
|
|
- //target: `http://gcls.helxsoft.cn/`,
|
|
|
+ // target: `http://gcls.helxsoft.cn/`,
|
|
|
changeOrigin: true,
|
|
|
pathRewrite: {
|
|
|
['^' + process.env.VUE_APP_BASE_API]: ''
|
|
|
}
|
|
|
},
|
|
|
+ [process.env.VUE_APP_PDF]: {
|
|
|
+ // target: 'https://file-kf.helxsoft.cn/',
|
|
|
+ target: 'https://file-cs.helxsoft.cn/',
|
|
|
+ changeOrigin: true,
|
|
|
+ pathRewrite: {
|
|
|
+ ['^' + process.env.VUE_APP_PDF]: ''
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
- after: require('./mock/mock-server.js')
|
|
|
+ // after: require('./mock/mock-server.js')
|
|
|
},
|
|
|
configureWebpack: {
|
|
|
// 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: name,
|
|
|
+ name,
|
|
|
resolve: {
|
|
|
alias: {
|
|
|
'@': resolve('src')
|
|
@@ -85,16 +93,16 @@ module.exports = {
|
|
|
// https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/cli-service/lib/config/app.js#L171
|
|
|
fileBlacklist: [/\.map$/, /hot-update\.js$/, /runtime\..*\.js$/],
|
|
|
include: 'initial'
|
|
|
- }])
|
|
|
+ }]);
|
|
|
|
|
|
// when there are many pages, it will cause too many meaningless requests
|
|
|
- config.plugins.delete('prefetch')
|
|
|
+ config.plugins.delete('prefetch');
|
|
|
|
|
|
// set svg-sprite-loader
|
|
|
config.module
|
|
|
.rule('svg')
|
|
|
.exclude.add(resolve('src/icons'))
|
|
|
- .end()
|
|
|
+ .end();
|
|
|
config.module
|
|
|
.rule('icons')
|
|
|
.test(/\.svg$/)
|
|
@@ -105,7 +113,7 @@ module.exports = {
|
|
|
.options({
|
|
|
symbolId: 'icon-[name]'
|
|
|
})
|
|
|
- .end()
|
|
|
+ .end();
|
|
|
|
|
|
config.when(process.env.NODE_ENV !== 'development', config => {
|
|
|
config
|
|
@@ -115,7 +123,7 @@ module.exports = {
|
|
|
// `runtime` must same as runtimeChunk name. default is `runtime`
|
|
|
inline: /runtime\..*\.js$/
|
|
|
}])
|
|
|
- .end()
|
|
|
+ .end();
|
|
|
config.optimization.splitChunks({
|
|
|
chunks: 'all',
|
|
|
cacheGroups: {
|
|
@@ -138,9 +146,9 @@ module.exports = {
|
|
|
reuseExistingChunk: true
|
|
|
}
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
// https:// webpack.js.org/configuration/optimization/#optimizationruntimechunk
|
|
|
- config.optimization.runtimeChunk('single')
|
|
|
- })
|
|
|
+ config.optimization.runtimeChunk('single');
|
|
|
+ });
|
|
|
}
|
|
|
-}
|
|
|
+};
|