Skip to content

Commit 0a46dc1

Browse files
Berkeley MartinezBerkeley Martinez
Berkeley Martinez
authored and
Berkeley Martinez
committed
Fix for vendor files not working correctly with manifest
1 parent 87fa381 commit 0a46dc1

File tree

4 files changed

+18
-32
lines changed

4 files changed

+18
-32
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public/js/commonFramework*
4444
public/js/sandbox*
4545
public/js/iFrameScripts*
4646
public/js/plugin*
47+
public/js/vendor*
4748
public/css/main*
4849

4950
server/rev-manifest.json

gulpfile.js

+12-27
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ var Rx = require('rx'),
1919
merge = require('merge-stream'),
2020

2121
// react app
22-
webpack = require('gulp-webpack'),
22+
webpack = require('webpack-stream'),
2323
webpackConfig = require('./webpack.config.js'),
2424
webpackConfigNode = require('./webpack.config.node.js'),
2525

@@ -356,40 +356,25 @@ function getFilesGlob(files) {
356356
});
357357
}
358358

359-
gulp.task('vendor', ['js'], function() {
359+
gulp.task('js', function() {
360360
var manifestName = 'js-manifest.json';
361361
var dest = paths.publicJs;
362362

363-
var vendorFiles = merge(
363+
var jsFiles = merge(
364+
364365
gulp.src(getFilesGlob(paths.vendorMain))
365366
.pipe(concat('vendor-main.js')),
367+
366368
gulp.src(paths.vendorChallenges)
367369
.pipe(__DEV__ ? gutil.noop() : uglify())
368-
.pipe(concat('vendor-challenges.js'))
369-
);
370+
.pipe(concat('vendor-challenges.js')),
370371

371-
return vendorFiles.pipe(gulp.dest(dest))
372-
// create registry file
373-
.pipe(rev())
374-
// copy revisioned assets to dest
375-
.pipe(gulp.dest(dest))
376-
// create manifest file
377-
.pipe(rev.manifest(manifestName))
378-
.pipe(delRev(
379-
dest,
380-
manifestName
381-
))
382-
// copy manifest file to dest
383-
.pipe(gulp.dest(paths.manifest));
384-
});
385-
386-
gulp.task('js', function() {
387-
var manifestName = 'js-manifest.json';
388-
var dest = paths.publicJs;
372+
gulp.src(paths.js)
373+
.pipe(plumber({ errorHandler: errorHandler }))
374+
.pipe(__DEV__ ? gutil.noop() : uglify())
375+
);
389376

390-
return gulp.src(paths.js)
391-
.pipe(plumber({ errorHandler: errorHandler }))
392-
.pipe(__DEV__ ? gutil.noop() : uglify())
377+
return jsFiles
393378
.pipe(gulp.dest(dest))
394379
// create registry file
395380
.pipe(rev())
@@ -444,7 +429,7 @@ function buildManifest() {
444429
.pipe(gulp.dest('server/'));
445430
}
446431

447-
var buildDependents = ['less', 'js', 'dependents', 'vendor'];
432+
var buildDependents = ['less', 'js', 'dependents'];
448433

449434
gulp.task('build-manifest', buildDependents, function() {
450435
return buildManifest();

package.json

+2-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"create-rev": "test ! -e server/rev-manifest.json && echo '\n\ncreating manifest\n\n' && touch server/rev-manifest.json && echo '{}' >> server/rev-manifest.json",
1111
"build": "NODE_ENV=production gulp build -p",
1212
"start": "babel-node server/server.js",
13-
"prestart-production": "bower cache clean && bower install && gulp build",
13+
"prestart-production": "bower cache clean && bower install && gulp build -p",
1414
"start-production": "node pm2Start",
1515
"lint": "npm run lint-js && npm run lint-json",
1616
"lint-challenges": "jsonlint -q seed/challenges/*.json",
@@ -122,12 +122,9 @@
122122
"url-regex": "^3.0.0",
123123
"validator": "^4.2.1",
124124
"webpack": "^1.9.12",
125+
"webpack-stream": "^2.1.1",
125126
"xss-filters": "^1.2.6",
126-
<<<<<<< HEAD
127127
"yargs": "^3.30.0"
128-
=======
129-
"yargs": "^3.29.0"
130-
>>>>>>> bundle vendor files
131128
},
132129
"devDependencies": {
133130
"blessed": "~0.1.81",

webpack.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
var webpack = require('webpack');
12
var path = require('path');
23
var webpack = require('webpack');
34

@@ -31,6 +32,8 @@ module.exports = {
3132
]
3233
},
3334
plugins: [
35+
new webpack.optimize.DedupePlugin(),
36+
new webpack.optimize.OccurenceOrderPlugin(true),
3437
new webpack.DefinePlugin({
3538
'process.env': {
3639
'NODE_ENV': JSON.stringify(__DEV__ ? 'development' : 'production')

0 commit comments

Comments
 (0)