@@ -35,10 +35,11 @@ const GLOBALS = {
35
35
// -----------------------------------------------------------------------------
36
36
37
37
const config = {
38
- context : path . join ( __dirname , '../src' ) ,
38
+ context : path . resolve ( __dirname , '../src' ) ,
39
39
40
40
output : {
41
- publicPath : '/' ,
41
+ path : path . resolve ( __dirname , '../build/public/assets' ) ,
42
+ publicPath : '/assets/' ,
42
43
sourcePrefix : ' ' ,
43
44
} ,
44
45
@@ -94,11 +95,18 @@ const config = {
94
95
} ,
95
96
{
96
97
test : / \. ( p n g | j p g | j p e g | g i f | s v g | w o f f | w o f f 2 ) $ / ,
97
- loader : 'url-loader?limit=10000' ,
98
+ loader : 'url-loader' ,
99
+ query : {
100
+ name : DEBUG ? '[path][name].[ext]?[hash]' : '[hash].[ext]' ,
101
+ limit : 10000 ,
102
+ } ,
98
103
} ,
99
104
{
100
105
test : / \. ( e o t | t t f | w a v | m p 3 ) $ / ,
101
106
loader : 'file-loader' ,
107
+ query : {
108
+ name : DEBUG ? '[path][name].[ext]?[hash]' : '[hash].[ext]' ,
109
+ } ,
102
110
} ,
103
111
{
104
112
test : / \. j a d e $ / ,
@@ -108,7 +116,7 @@ const config = {
108
116
} ,
109
117
110
118
resolve : {
111
- root : path . join ( __dirname , '../src' ) ,
119
+ root : path . resolve ( __dirname , '../src' ) ,
112
120
modulesDirectories : [ 'node_modules' ] ,
113
121
extensions : [ '' , '.webpack.js' , '.web.js' , '.js' , '.jsx' , '.json' ] ,
114
122
} ,
@@ -145,9 +153,8 @@ const clientConfig = extend(true, {}, config, {
145
153
entry : './client.js' ,
146
154
147
155
output : {
148
- path : path . join ( __dirname , '../build/public' ) ,
149
- filename : DEBUG ? '[name].js?[hash]' : '[name].[hash].js' ,
150
- chunkFilename : DEBUG ? '[name].[id].js?[hash]' : '[name].[id].[hash].js' ,
156
+ filename : DEBUG ? '[name].js?[chunkhash]' : '[name].[chunkhash].js' ,
157
+ chunkFilename : DEBUG ? '[name].[id].js?[chunkhash]' : '[name].[id].[chunkhash].js' ,
151
158
} ,
152
159
153
160
target : 'web' ,
@@ -161,21 +168,22 @@ const clientConfig = extend(true, {}, config, {
161
168
// Emit a file with assets paths
162
169
// https://github.com/sporto/assets-webpack-plugin#options
163
170
new AssetsPlugin ( {
164
- path : path . join ( __dirname , '../build' ) ,
171
+ path : path . resolve ( __dirname , '../build' ) ,
165
172
filename : 'assets.js' ,
166
173
processOutput : x => `module.exports = ${ JSON . stringify ( x ) } ;` ,
167
174
} ) ,
168
175
176
+ // Assign the module and chunk ids by occurrence count
177
+ // Consistent ordering of modules required if using any hashing ([hash] or [chunkhash])
178
+ // https://webpack.github.io/docs/list-of-plugins.html#occurrenceorderplugin
179
+ new webpack . optimize . OccurenceOrderPlugin ( true ) ,
180
+
169
181
...( DEBUG ? [ ] : [
170
182
171
183
// Search for equal or similar files and deduplicate them in the output
172
184
// https://webpack.github.io/docs/list-of-plugins.html#dedupeplugin
173
185
new webpack . optimize . DedupePlugin ( ) ,
174
186
175
- // Assign the module and chunk ids by occurrence count
176
- // https://webpack.github.io/docs/list-of-plugins.html#occurrenceorderplugin
177
- new webpack . optimize . OccurenceOrderPlugin ( true ) ,
178
-
179
187
// Minimize all JavaScript output of chunks
180
188
// https://github.com/mishoo/UglifyJS2#compressor-options
181
189
new webpack . optimize . UglifyJsPlugin ( {
@@ -204,8 +212,7 @@ const serverConfig = extend(true, {}, config, {
204
212
entry : './server.js' ,
205
213
206
214
output : {
207
- path : path . join ( __dirname , '../build' ) ,
208
- filename : 'server.js' ,
215
+ filename : '../../server.js' ,
209
216
libraryTarget : 'commonjs2' ,
210
217
} ,
211
218
0 commit comments