Skip to content

Commit aefd8bb

Browse files
committed
update
1 parent 40a7626 commit aefd8bb

File tree

4 files changed

+93
-37
lines changed

4 files changed

+93
-37
lines changed

.postcssrc.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
module.exports = {
44
"plugins": {
5-
"postcss-import": {},
6-
"postcss-url": {},
75
// to edit target browsers: use "browserslist" field in package.json
86
"autoprefixer": {}
97
}

package.json

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
"axios": "0.18.0",
3838
"clipboard": "1.7.1",
3939
"codemirror": "5.39.2",
40-
"connect": "3.6.6",
4140
"driver.js": "0.5.2",
4241
"dropzone": "5.2.0",
4342
"echarts": "4.1.0",
@@ -49,7 +48,7 @@
4948
"jszip": "3.1.5",
5049
"normalize.css": "7.0.0",
5150
"nprogress": "0.2.0",
52-
"path-to-regexp": "^2.4.0",
51+
"path-to-regexp": "2.4.0",
5352
"screenfull": "3.3.3",
5453
"showdown": "1.8.6",
5554
"simplemde": "1.11.2",
@@ -64,30 +63,21 @@
6463
"xlsx": "^0.11.16"
6564
},
6665
"devDependencies": {
67-
"@babel/core": "7.0.0",
6866
"@babel/register": "7.0.0",
69-
"@vue/babel-helper-vue-jsx-merge-props": "0.1.0",
70-
"@vue/cli-plugin-babel": "^3.0.5",
71-
"@vue/cli-plugin-eslint": "^3.0.5",
72-
"@vue/cli-plugin-unit-mocha": "^3.0.5",
73-
"@vue/cli-service": "^3.0.5",
74-
"@vue/eslint-config-standard": "^3.0.5",
75-
"@vue/test-utils": "^1.0.0-beta.25",
76-
"autoprefixer": "8.5.0",
77-
"babel-plugin-istanbul": "^4.1.6",
67+
"@vue/cli-plugin-babel": "3.0.5",
68+
"@vue/cli-plugin-eslint": "3.0.5",
69+
"@vue/cli-plugin-unit-jest": "3.0.5",
70+
"@vue/cli-service": "3.0.5",
71+
"@vue/test-utils": "1.0.0-beta.25",
72+
"babel-core": "7.0.0-bridge.0",
73+
"babel-jest": "23.6.0",
7874
"husky": "0.14.3",
7975
"lint-staged": "7.2.2",
8076
"mockjs": "1.0.1-beta3",
81-
"node-notifier": "5.2.1",
8277
"node-sass": "^4.7.2",
83-
"optimize-css-assets-webpack-plugin": "5.0.0",
84-
"postcss-import": "11.1.0",
85-
"postcss-loader": "2.1.6",
86-
"postcss-url": "7.3.2",
8778
"sass-loader": "7.0.3",
8879
"script-ext-html-webpack-plugin": "2.0.1",
8980
"script-loader": "0.7.2",
90-
"shelljs": "0.8.2",
9181
"svg-sprite-loader": "3.8.0",
9282
"svgo": "1.0.5",
9383
"vue-template-compiler": "2.5.17"

public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<meta name="renderer" content="webkit">
77
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
88
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
9-
<title>vue-element-admin</title>
9+
<title><%= webpackConfig.name %></title>
1010
</head>
1111
<body>
1212
<script src="<%= BASE_URL %>static/tinymce4.7.5/tinymce.min.js"></script>

vue.config.js

Lines changed: 84 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,47 @@
11
'use strict'
2-
require('@babel/register')
32
const path = require('path')
4-
const bodyParser = require('body-parser')
53

64
function resolve(dir) {
75
return path.join(__dirname, dir)
86
}
97

8+
const port = 9527 // TODO: change to Settings
9+
10+
// Explanation of each configuration item You can find it in https://cli.vuejs.org/config/
1011
module.exports = {
12+
/**
13+
* You can set by yourself according to actual condition
14+
* You will need to set this if you plan to deploy your site under a sub path,
15+
* for example GitHub pages. If you plan to deploy your site to https://foo.github.io/bar/,
16+
* then assetsPublicPath should be set to "/bar/".
17+
* In most cases please use '/' !!!
18+
* Detail https://cli.vuejs.org/config/#baseurl
19+
*/
20+
baseUrl: '/',
21+
outputDir: 'dist',
22+
assetsDir: 'static',
23+
lintOnSave: process.env.NODE_ENV !== 'production',
24+
productionSourceMap: false,
1125
devServer: {
26+
port: port,
1227
open: true,
28+
overlay: {
29+
warnings: false,
30+
errors: true
31+
},
1332
proxy: {
1433
'/api': {
15-
target: 'http://localhost:8080/mock',
34+
target: `http://localhost:${port}/mock`,
1635
changeOrigin: true,
1736
pathRewrite: {
1837
'^/api': ''
1938
}
2039
}
2140
},
2241
after(app) {
42+
console.log('apple')
43+
const bodyParser = require('body-parser')
44+
require('@babel/register')
2345
// parse app.body
2446
// http://expressjs.com/en/4x/api.html#req.body
2547
app.use(bodyParser.json())
@@ -33,28 +55,74 @@ module.exports = {
3355
}
3456
},
3557
configureWebpack: {
58+
// We provide the app's title in Webpack's name field, so that
59+
// it can be accessed in index.html to inject the correct title.
60+
name: 'vue-element-admin', // TODO: change to Settings
3661
resolve: {
3762
alias: {
38-
'$@': resolve('src/components')
63+
'@': resolve('src')
3964
}
40-
},
41-
module: {
42-
rules: [
43-
{
44-
test: /\.svg$/,
45-
loader: 'svg-sprite-loader',
46-
include: [resolve('src/icons')],
47-
options: {
48-
symbolId: 'icon-[name]'
49-
}
50-
}
51-
]
5265
}
5366
},
5467
chainWebpack(config) {
68+
config.plugins.delete('preload')// TODO: need test
69+
config.plugins.delete('prefetch')// TODO: need test
5570
config.module
5671
.rule('svg')
5772
.exclude.add(resolve('src/icons'))
5873
.end()
74+
config.module
75+
.rule('icons')
76+
.test(/\.svg$/)
77+
.include.add(resolve('src/icons'))
78+
.end()
79+
.use('svg-sprite-loader')
80+
.loader('svg-sprite-loader')
81+
.options({
82+
symbolId: 'icon-[name]'
83+
})
84+
.end()
85+
86+
config
87+
.when(process.env.NODE_ENV === 'development',
88+
config => config.devtool('cheap-source-map')
89+
)
90+
91+
config
92+
.when(process.env.NODE_ENV !== 'development',
93+
config => {
94+
config
95+
.plugin('ScriptExtHtmlWebpackPlugin')
96+
.use('script-ext-html-webpack-plugin', [{
97+
// `runtime` must same as runtimeChunk name. default is `runtime`
98+
inline: /runtime\..*\.js$/
99+
}])
100+
config
101+
.optimization.splitChunks({
102+
chunks: 'all',
103+
cacheGroups: {
104+
libs: {
105+
name: 'chunk-libs',
106+
test: /[\\/]node_modules[\\/]/,
107+
priority: 10,
108+
chunks: 'initial' // 只打包初始时依赖的第三方
109+
},
110+
elementUI: {
111+
name: 'chunk-elementUI', // 单独将 elementUI 拆包
112+
priority: 20, // 权重要大于 libs 和 app 不然会被打包进 libs 或者 app
113+
test: /[\\/]node_modules[\\/]element-ui[\\/]/
114+
},
115+
commons: {
116+
name: 'chunk-commons',
117+
test: resolve('src/components'), // 可自定义拓展你的规则
118+
minChunks: 3, // 最小公用次数
119+
priority: 5,
120+
reuseExistingChunk: true
121+
}
122+
}
123+
})
124+
config.optimization.runtimeChunk('single')
125+
}
126+
)
59127
}
60128
}

0 commit comments

Comments
 (0)