Skip to content

Commit 743f349

Browse files
author
sean
committed
fix(Project): Fix vendor build_file bug and use manifast chunk
1 parent 5c6ef45 commit 743f349

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

lib/models/Project.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,16 +287,22 @@ var Project = function () {
287287
}
288288
vendors = commonsChunk.vendors;
289289
if ((typeof vendors === 'undefined' ? 'undefined' : (0, _typeof3.default)(vendors)) === 'object' && vendors !== undefined) {
290+
var i = 0;
290291
for (var name in vendors) {
291292
if (vendors.hasOwnProperty(name) && vendors[name]) {
293+
i++;
292294
chunks.push(name);
293295
webpackConfig.entry[name] = Array.isArray(vendors[name]) ? vendors[name] : [vendors[name]];
294296
}
295297
}
298+
if (i > 0) {
299+
chunks.push('manifest');
300+
}
296301
}
297302
newfilename = commonsChunk.filename ? commonsChunk.filename : '[name].js';
298303

299304
if (chunks.length > 0) {
305+
300306
webpackConfig.plugins.push(new webpack.optimize.CommonsChunkPlugin({
301307
name: chunks,
302308
filename: handleFilename(newfilename, filenameTpl.filename),

src/models/Project.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,23 +268,31 @@ class Project {
268268
}
269269
vendors = commonsChunk.vendors;
270270
if (typeof vendors === 'object' && vendors !== undefined) {
271+
var i=0;
271272
for (var name in vendors) {
272273
if (vendors.hasOwnProperty(name) && vendors[name]) {
274+
i++;
273275
chunks.push(name);
274276
webpackConfig.entry[name] = Array.isArray(vendors[name]) ? vendors[name] : [vendors[name]];
275277
}
276278
}
279+
if(i > 0){
280+
chunks.push('manifest');
281+
}
282+
277283
}
278284
newfilename = commonsChunk.filename ? commonsChunk.filename : '[name].js';
279285

280286
if (chunks.length > 0) {
287+
281288
webpackConfig.plugins.push(
282289
new webpack.optimize.CommonsChunkPlugin({
283290
name: chunks,
284291
filename: handleFilename(newfilename, filenameTpl.filename),
285292
minChunks: commonsChunk.minChunks ? commonsChunk.minChunks : 2
286293
})
287-
);
294+
);
295+
288296
}
289297
}
290298
}

0 commit comments

Comments
 (0)