Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitda98ad8

Browse files
committed
打包配置
1 parent30f5df2 commitda98ad8

File tree

3 files changed

+58
-1
lines changed

3 files changed

+58
-1
lines changed

‎build/webpack.dll.conf.js‎

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
varpath=require('path')
2+
varwebpack=require('webpack')
3+
4+
functionresolve(dir){
5+
returnpath.join(__dirname,'..',dir)
6+
}
7+
8+
module.exports={
9+
// 你想要打包的模块的数组
10+
entry:{
11+
vendor:[
12+
'vue',
13+
'lodash',
14+
'vuex',
15+
'axios',
16+
'vue-router',
17+
'iview',
18+
'element-ui',
19+
'echarts',
20+
'xlsx',
21+
'jquery',
22+
'vue-fullcalendar',
23+
'vue-cookie',
24+
'handsontable',
25+
],
26+
},
27+
output:{
28+
path:path.join(__dirname,'../dist/vendor-dll-js'),// 打包后文件输出的位置
29+
filename:'[name].dll.js',
30+
library:'[name]_library',
31+
// vendor.dll.js中暴露出的全局变量名。
32+
// 主要是给DllPlugin中的name使用,
33+
// 故这里需要和webpack.DllPlugin中的`name: '[name]_library',`保持一致。
34+
},
35+
resolve:{
36+
extensions:['.js','.vue','.json'],
37+
alias:{
38+
vue$:'vue/dist/vue.esm.js',
39+
'@':resolve('src'),
40+
},
41+
},
42+
plugins:[
43+
newwebpack.DllPlugin({
44+
path:path.join(__dirname,'.','[name]-manifest.json'),
45+
name:'[name]_library',
46+
context:__dirname,
47+
}),
48+
// 压缩打包的文件,与该文章主线无关
49+
newwebpack.optimize.UglifyJsPlugin({
50+
compress:{
51+
warnings:false,
52+
},
53+
}),
54+
],
55+
}

‎index.html‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@
1010
<!-- built files will be auto injected -->
1111
</body>
1212
</html>
13+
<scriptsrc="./dist/vendor-dll-js/vendor.dll.js"></script>

‎package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"e2e":"node test/e2e/runner.js",
1212
"test":"npm run unit && npm run e2e",
1313
"lint":"eslint --ext .js,.vue src test/unit test/e2e/specs",
14-
"build":"node build/build.js"
14+
"build":"node build/build.js",
15+
"dll":"webpack -p --progress --config build/webpack.dll.conf.js"
1516
},
1617
"dependencies": {
1718
"element-ui":"^2.13.2",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp