-
-
Save Industrial/36c747860fad05259a2b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"presets": ["es2015", "stage-0", "react"], | |
"env": { | |
"development": { | |
"plugins": [ | |
["react-transform", { | |
"transforms": [ | |
{ | |
"transform": "react-transform-hmr", | |
"imports": ["react"], | |
"locals": ["module"] | |
}, | |
{ | |
"transform": "react-transform-catch-errors", | |
"imports": ["react", "redbox-react"] | |
} | |
] | |
}] | |
] | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HMR] Attempting websocket connection to http://localhost:3123 | |
[HMR] Websocket connection successful. | |
[HMR] Updated modules ["client/wireframes/pages/home.js", "client/wireframes/routes.js", "client/app.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[14:01:31] Starting 'watch'... | |
[14:01:31] Starting 'build'... | |
[14:01:31] Starting 'css'... | |
[14:01:31] Finished 'css' after 51 ms | |
[14:01:31] Starting 'build-src'... | |
[14:01:32] Finished 'build-src' after 797 ms | |
[14:01:32] Starting 'build-libs'... | |
[14:01:34] Finished 'build-libs' after 2.56 s | |
[14:01:34] Starting 'copy-html'... | |
[14:01:34] Finished 'copy-html' after 2.81 ms | |
[14:01:34] Finished 'build' after 3.42 s | |
[14:01:34] Starting 'watchClient'... | |
[14:01:34] Finished 'watchClient' after 11 ms | |
[14:01:34] Starting 'watchExternalLibraries'... | |
[14:01:34] Finished 'watchExternalLibraries' after 2.21 ms | |
[14:01:34] Starting 'watchPackageJSON'... | |
[14:01:34] Finished 'watchPackageJSON' after 738 μs | |
[14:01:34] Starting 'watchBrowserify'... | |
[14:01:34] Finished 'watchBrowserify' after 53 ms | |
[14:01:34] Finished 'watch' after 3.49 s | |
14:01:37 GMT+0100 (CET) [HMR] Emitting updates | |
14:01:37 GMT+0100 (CET) [HMR] Listening on localhost:3123 | |
[14:01:38] browserify 1901419 bytes written (3.63 seconds) | |
14:01:40 GMT+0100 (CET) [HMR] User connected, syncing | |
14:01:44 GMT+0100 (CET) [HMR] User connected, syncing | |
14:01:50 GMT+0100 (CET) [HMR] Emitting updates | |
[14:01:50] browserify 1901416 bytes written (0.43 seconds) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
module.exports = (gulp, config) => { | |
return { | |
watchBrowserify: { | |
fn: watchBrowserify, | |
help: 'Watches the browserify build.' | |
} | |
}; | |
function watchBrowserify() { | |
const babelify = require('babelify'); | |
const browserify = require('browserify'); | |
const browserifyHMR = require('browserify-hmr'); | |
const uglifyify = require('uglifyify'); | |
const vinylSourceStream = require('vinyl-source-stream'); | |
const watchify = require('watchify'); | |
const gutil = require('gulp-util'); | |
const commonBrowserify = require('./common/browserify'); | |
const browserifyBundle = browserify('client/app.js', { | |
cache: {}, | |
packageCache: {}, | |
debug: false, | |
}); | |
// Transforms | |
browserifyBundle.transform(babelify); | |
browserifyBundle.transform(commonBrowserify.getImportFilter(browserifyBundle)); | |
if (config.uglify) { | |
browserifyBundle.transform(config.uglify, uglifyify); | |
} | |
// Plugins | |
browserifyBundle.plugin(browserifyHMR); | |
browserifyBundle.plugin(watchify); | |
commonBrowserify.getExternalLibsSync(); | |
function bundle() { | |
browserifyBundle.bundle() | |
.pipe(vinylSourceStream('main.js')) | |
.pipe(gulp.dest(config.folders.build)) | |
.on('end', error => { | |
if (error) { | |
console.error(error); | |
} | |
commonBrowserify.setExternalLibsSync(); | |
}); | |
} | |
browserifyBundle | |
.on('log', (message) => { | |
gutil.log('browserify', message); | |
}); | |
browserifyBundle | |
.on('update', bundle); | |
bundle(); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment