1- var HtmlWebpackPlugin = require ( ' html-webpack-plugin' ) ;
2- var path = require ( ' path' ) ;
3- var APP_DIR = path . resolve ( __dirname , ' src' ) ;
4- const ExtractTextPlugin = require ( ' extract-text-webpack-plugin' ) ;
5- const MiniCssExtractPlugin = require ( ' mini-css-extract-plugin' ) ;
1+ let HtmlWebpackPlugin = require ( " html-webpack-plugin" ) ;
2+ let path = require ( " path" ) ;
3+ let APP_DIR = path . resolve ( __dirname , " src" ) ;
4+ const ExtractTextPlugin = require ( " extract-text-webpack-plugin" ) ;
5+ const MiniCssExtractPlugin = require ( " mini-css-extract-plugin" ) ;
66
77module . exports = {
8- entry : APP_DIR + '/index.js' ,
9- mode : 'development' ,
10- resolve : {
11- extensions : [ '.js' , '.jsx' ]
12- } ,
13- module : {
14- rules : [
15- {
16- test : / \. j s x ? $ / ,
17- loader : 'babel-loader'
18- } ,
19- {
20- test : / \. c s s $ / ,
21- use : [
22- {
23- loader : MiniCssExtractPlugin . loader ,
24- options : {
25- // you can specify a publicPath here
26- // by default it uses publicPath in webpackOptions.output
27- publicPath : '../' ,
28- hmr : process . env . NODE_ENV === 'development' ,
29- } ,
30- } ,
31- 'css-loader' ,
32- ] ,
33- } ,
34- {
35- test : / \. ( p n g | j p e ? g | g i f ) $ / ,
36- use : [
37- {
38- loader : 'file-loader' ,
39- options : { } ,
40- } ,
41- ] ,
42- } ,
8+ entry : APP_DIR + "/index.js" ,
9+ mode : "development" ,
10+ resolve : {
11+ extensions : [ ".js" , ".jsx" ]
12+ } ,
13+ module : {
14+ rules : [
15+ {
16+ test : / \. j s x ? $ / ,
17+ loader : "babel-loader"
18+ } ,
19+ {
20+ test : / \. c s s $ / ,
21+ use : [
22+ {
23+ loader : MiniCssExtractPlugin . loader ,
24+ options : {
25+ // you can specify a publicPath here
26+ // by default it uses publicPath in webpackOptions.output
27+ publicPath : "../" ,
28+ hmr : process . env . NODE_ENV === "development"
29+ }
30+ } ,
31+ "css-loader"
4332 ]
44- } ,
45- plugins : [ new HtmlWebpackPlugin ( {
46- template : './src/index.html'
33+ } ,
34+ {
35+ test : / \. ( p n g | j p e ? g | g i f ) $ / ,
36+ use : [
37+ {
38+ loader : "file-loader" ,
39+ options : { }
40+ }
41+ ]
42+ }
43+ ]
44+ } ,
45+ plugins : [
46+ new HtmlWebpackPlugin ( {
47+ template : "./src/index.html"
4748 } ) ,
4849 new MiniCssExtractPlugin ( {
49- // Options similar to the same options in webpackOptions.output
50- // both options are optional
51- filename : ' [name].css' ,
52- chunkFilename : ' [id].css' ,
53- } ) ,
54- ] ,
55- devServer : {
56- historyApiFallback : true
57- } ,
58- externals : {
59- // global app config object
60- config : JSON . stringify ( {
61- apiUrl : ' http://localhost:4000'
62- } )
63- }
64- }
50+ // Options similar to the same options in webpackOptions.output
51+ // both options are optional
52+ filename : " [name].css" ,
53+ chunkFilename : " [id].css"
54+ } )
55+ ] ,
56+ devServer : {
57+ historyApiFallback : true
58+ } ,
59+ externals : {
60+ // global app config object
61+ config : JSON . stringify ( {
62+ apiUrl : " http://localhost:4000"
63+ } )
64+ }
65+ } ;
0 commit comments