@@ -4,39 +4,114 @@ var BrowserSyncPlugin = require('browser-sync-webpack-plugin');
4
4
var path = require ( 'path' ) ;
5
5
var BundleAnalyzerPlugin = require ( 'webpack-bundle-analyzer' ) . BundleAnalyzerPlugin ;
6
6
7
- module . exports = {
7
+ var browserSyncPlugin = new BrowserSyncPlugin ( {
8
+ // use existing Apache virtual host
9
+ proxy : 'http://localhost:80/' ,
10
+ tunnel : false ,
11
+ // watch the built files and the index file
12
+ files : [
13
+ './public/build/*' ,
14
+ './public/index.php' ,
15
+ './public/api/*.php' ,
16
+ './admin/index.php' ,
17
+ './admin/src/index.js' ,
18
+ './admin/build/*'
19
+ ]
20
+ } ) ;
21
+
22
+ var plugins = [
23
+ new webpack . LoaderOptionsPlugin ( {
24
+ debug :true ,
25
+ } ) ,
26
+
27
+ browserSyncPlugin ,
28
+
29
+ new webpack . ProvidePlugin ( {
30
+ //jQuery : 'jquery',
31
+ //$ : 'jquery',
32
+ //jquery : 'jquery',
33
+ _ : 'lodash'
34
+ } ) ,
35
+
36
+ //new BundleAnalyzerPlugin()
37
+
38
+ ]
39
+
40
+ var client = {
8
41
devtool : "#cheap-module-eval-source-map" ,
9
42
entry : "./src/index.js" ,
10
43
output : {
11
44
path : path . join ( __dirname , "public/build" ) ,
12
45
filename :"bundle.js" ,
13
46
publicPath :"build/"
14
47
} ,
15
- plugins : [
16
-
17
- new webpack . LoaderOptionsPlugin ( {
18
- debug :true ,
19
- } ) ,
20
- // reloads browser when the watched files change
21
- new BrowserSyncPlugin ( {
22
- // use existing Apache virtual host
23
- proxy : 'http://localhost:80/' ,
24
- tunnel : false ,
25
- // watch the built files and the index file
26
- files : [ './public/build/*' , './public/index.php' , './public/api/*.php' ]
27
- } ) ,
28
-
29
- new webpack . ProvidePlugin ( {
30
- //jQuery : 'jquery',
31
- //$ : 'jquery',
32
- //jquery : 'jquery',
33
- _ : 'lodash'
34
- } ) ,
35
-
36
-
37
- //new BundleAnalyzerPlugin()
48
+ plugins : plugins ,
49
+ //target: 'node',
50
+ //node: {fs: "empty"},
51
+ module :{
52
+ loaders :[
53
+ {
54
+ test : / \. j s $ / ,
55
+ exclude : / ( n o d e _ m o d u l e s ) / ,
56
+ loader : "babel-loader" ,
57
+ query : {
58
+ presets : [ "env" , "stage-0" , "react" ] ,
59
+ plugins : [ "react-html-attrs" , "transform-class-properties" , "transform-decorators-legacy" ]
60
+ }
61
+ } ,
62
+ {
63
+ test : / \. j s o n $ / ,
64
+ exclude : / ( n o d e _ m o d u l e s ) / ,
65
+ loader :"json-loader" ,
66
+ } ,
67
+ {
68
+ test : / \. s c s s $ / ,
69
+ exclude : / ( n o d e _ m o d u l e s ) / ,
70
+ loader :"style-loader!css-loader!sass-loader"
71
+ } ,
72
+ {
73
+ test : / \. c s s $ / ,
74
+ loader : "style-loader!css-loader"
75
+ } ,
76
+ {
77
+ test : / \. p n g $ / ,
78
+ loader : "url-loader?limit=100000"
79
+ } ,
80
+ {
81
+ test : / \. j p g $ / ,
82
+ loader : "file-loader"
83
+ } ,
84
+ {
85
+ test : / \. ( w o f f | w o f f 2 ) ( \? v = \d + \. \d + \. \d + ) ? $ / ,
86
+ loader : 'url-loader?limit=10000&mimetype=application/font-woff'
87
+ } ,
88
+ {
89
+ test : / \. t t f ( \? v = \d + \. \d + \. \d + ) ? $ / ,
90
+ loader : 'url-loader?limit=10000&mimetype=application/octet-stream'
91
+ } ,
92
+ {
93
+ test : / \. e o t ( \? v = \d + \. \d + \. \d + ) ? $ / ,
94
+ loader : 'file-loader'
95
+ } ,
96
+ {
97
+ test : / \. s v g ( \? v = \d + \. \d + \. \d + ) ? $ / ,
98
+ loader : 'url-loader?limit=10000&mimetype=image/svg+xml'
99
+ }
100
+ ]
101
+ }
102
+ } ;
38
103
39
- ] ,
104
+ var admin = {
105
+ devtool : "#cheap-module-eval-source-map" ,
106
+ entry : "./admin/src/index.js" ,
107
+ output : {
108
+ path : path . join ( __dirname , "admin/build" ) ,
109
+ filename :"bundle.js" ,
110
+ publicPath :"admin/build/"
111
+ } ,
112
+ plugins : plugins ,
113
+ //target: 'node',
114
+ //node: {fs: "empty"},
40
115
module :{
41
116
loaders :[
42
117
{
@@ -89,3 +164,8 @@ module.exports = {
89
164
]
90
165
}
91
166
} ;
167
+
168
+ module . exports = [
169
+ client ,
170
+ admin
171
+ ] ;
0 commit comments