11var path = require ( 'path' )
22var utils = require ( './utils' )
3- var config = require ( '../config' )
3+ var config = require ( '../config/index ' )
44var vueLoaderConfig = require ( './vue-loader.conf' )
55
66function resolve ( dir ) {
@@ -9,14 +9,14 @@ function resolve (dir) {
99
1010module . exports = {
1111 entry : {
12- app : './src/main.js'
12+ app : './src/main.js' ,
13+ vendor : [ 'vue' , 'vuex' , 'vue-router' , 'element-ui' ] //第三方库和框架
1314 } ,
1415 output : {
16+ // path仅仅告诉Webpack结果存储在哪里,然而publicPath项则被许多Webpack的插件用于在生产模式下更新内嵌到css、html文件里的url值。
1517 path : config . build . assetsRoot ,
1618 filename : '[name].js' ,
17- publicPath : process . env . NODE_ENV === 'production'
18- ? config . build . assetsPublicPath
19- : config . dev . assetsPublicPath
19+ publicPath : config . dev . assetsPublicPath
2020 } ,
2121 resolve : {
2222 extensions : [ '.js' , '.vue' , '.json' ] ,
@@ -43,22 +43,31 @@ module.exports = {
4343 {
4444 test : / \. j s $ / ,
4545 loader : 'babel-loader' ,
46+ exclude : / ( n o d e _ m o d u l e s | b o w e r _ c o m p o n e n t s ) / ,
4647 include : [ resolve ( 'src' ) , resolve ( 'test' ) ]
4748 } ,
4849 {
4950 test : / \. ( p n g | j p e ? g | g i f | s v g ) ( \? .* ) ? $ / ,
5051 loader : 'url-loader' ,
51- query : {
52- limit : 10000 ,
53- name : utils . assetsPath ( 'img/[name].[hash:7].[ext]' )
52+ options : {
53+ limit : 5120 ,
54+ name : utils . assetsPath ( 'img/[name].[ext]' )
55+ }
56+ } ,
57+ {
58+ test : / \. ( m p 4 | w e b m | o g g | m p 3 | w a v | f l a c | a a c ) ( \? .* ) ? $ / ,
59+ loader : 'url-loader' ,
60+ options : {
61+ limit : 10240 ,
62+ name : utils . assetsPath ( 'media/[name].[ext]' )
5463 }
5564 } ,
5665 {
5766 test : / \. ( w o f f 2 ? | e o t | t t f | o t f ) ( \? .* ) ? $ / ,
5867 loader : 'url-loader' ,
59- query : {
60- limit : 10000 ,
61- name : utils . assetsPath ( 'fonts/[name].[hash:7].[ ext]' )
68+ options : {
69+ limit : 10240 ,
70+ name : utils . assetsPath ( 'fonts/[name].[ext]' )
6271 }
6372 }
6473 ]
0 commit comments