1- var webpack = require ( 'webpack' ) ;
2- var path = require ( 'path' ) ;
3- var glob = require ( 'glob' ) ;
4- var ExtractTextPlugin = require ( 'extract-text-webpack-plugin' ) ;
5- var CleanWebpackPlugin = require ( 'clean-webpack-plugin' ) ;
6- var ManifestPlugin = require ( 'webpack-manifest-plugin' ) ;
7- var BrowserSyncPlugin = require ( 'browser-sync-webpack-plugin' ) ;
8- var config = require ( './config' ) ;
9- var inProduction = process . env . NODE_ENV === 'production' ;
10- var styleHash = inProduction ? 'contenthash' : 'hash' ;
11- var scriptHash = inProduction ? 'chunkhash' : 'hash' ;
1+ const webpack = require ( 'webpack' ) ;
2+ const path = require ( 'path' ) ;
3+ const glob = require ( 'glob' ) ;
4+ const ExtractTextPlugin = require ( 'extract-text-webpack-plugin' ) ;
5+ const CleanWebpackPlugin = require ( 'clean-webpack-plugin' ) ;
6+ const ManifestPlugin = require ( 'webpack-manifest-plugin' ) ;
7+ const BrowserSyncPlugin = require ( 'browser-sync-webpack-plugin' ) ;
8+ const config = require ( './config' ) ;
9+
10+ const inProduction = process . env . NODE_ENV === 'production' ;
11+ const styleHash = inProduction ? 'contenthash' : 'hash' ;
12+ const scriptHash = inProduction ? 'chunkhash' : 'hash' ;
1213
1314module . exports = {
1415 entry : {
@@ -31,16 +32,12 @@ module.exports = {
3132 // Since sass-loader (weirdly) has SCSS as its default parse mode, we map
3233 // the "scss" and "sass" values for the lang attribute to the right configs here.
3334 // other preprocessors should work out of the box, no loader config like this necessary.
34- 'scss' : [
35+ scss : [ 'vue-style-loader' , 'css-loader' , 'sass-loader' ] ,
36+ sass : [
3537 'vue-style-loader' ,
3638 'css-loader' ,
37- 'sass-loader'
39+ 'sass-loader?indentedSyntax' ,
3840 ] ,
39- 'sass' : [
40- 'vue-style-loader' ,
41- 'css-loader' ,
42- 'sass-loader?indentedSyntax'
43- ]
4441 } ,
4542 // other vue-loader options go here
4643 } ,
@@ -56,7 +53,7 @@ module.exports = {
5653 } ,
5754 {
5855 loader : 'sass-loader' ,
59- options : { sourceMap : true , } ,
56+ options : { sourceMap : true } ,
6057 } ,
6158 ] ,
6259 } ) ,
@@ -74,19 +71,29 @@ module.exports = {
7471 options : {
7572 name : '[name].[ext]' ,
7673 outputPath : 'images/' ,
77- publicPath : config . assetsPath + ' static/' ,
74+ publicPath : ` ${ config . assetsPath } static/` ,
7875 } ,
7976 } ,
8077 'image-webpack-loader' ,
8178 ] ,
8279 } ,
80+ {
81+ test : / \. ( w o f f 2 ? | e o t | t t f | o t f ) ( \? .* ) ? $ / ,
82+ loader : 'url-loader' ,
83+ options : {
84+ limit : 10000 ,
85+ name : '[name].[hash:7].[ext]' ,
86+ outputPath : 'fonts/' ,
87+ publicPath : `${ config . assetsPath } static/` ,
88+ } ,
89+ } ,
8390 ] ,
8491 } ,
8592
8693 resolve : {
8794 alias : {
88- ' vue$' : 'vue/dist/vue.esm.js' ,
89- ' images' : path . join ( __dirname , '../resources/assets/images' ) ,
95+ vue$ : 'vue/dist/vue.esm.js' ,
96+ images : path . join ( __dirname , '../resources/assets/images' ) ,
9097 } ,
9198 extensions : [ '*' , '.js' , '.vue' , '.json' ] ,
9299 } ,
@@ -98,14 +105,10 @@ module.exports = {
98105 host : 'localhost' ,
99106 port : 3000 ,
100107 proxy : config . devUrl , // YOUR DEV-SERVER URL
101- files : [
102- '../*.php' ,
103- '../resources/views/*.twig' ,
104- '../static/*.*' ,
105- ] ,
108+ files : [ '../*.php' , '../resources/views/*.twig' , '../static/*.*' ] ,
106109 } ) ,
107110
108- new CleanWebpackPlugin ( [ 'static/css/*' , 'static/js/*' ] , {
111+ new CleanWebpackPlugin ( [ 'static/css/*' , 'static/js/*' , 'static/fonts/*' ] , {
109112 watch : true ,
110113 root : path . resolve ( __dirname , '../' ) ,
111114 } ) ,
@@ -122,10 +125,8 @@ if (inProduction) {
122125 module . exports . plugins . push ( new webpack . optimize . UglifyJsPlugin ( ) ) ;
123126
124127 module . exports . plugins . push ( new webpack . DefinePlugin ( {
125- 'process.env' : {
126- NODE_ENV : '"production"'
127- }
128- } )
129- ) ;
130-
128+ 'process.env' : {
129+ NODE_ENV : '"production"' ,
130+ } ,
131+ } ) ) ;
131132}
0 commit comments