Comments (11)
Thanks for the heads up. I had noticed that on the project I'm working on now. I'll keep an eye on it.
from blendid.
I saw this referenced from the watchify issue, thought I'd point out that it's watchify v 0.8.1 that still works.
from blendid.
updated my comment... my typo... thanks
from blendid.
Using Watchify ~1.0.1 I get this
TypeError: Cannot read property 'cache' of undefined
at watchify (/Users/antoniobrandao/project/node_modules/watchify/index.js:13:27)
function watchify (b, opts) {
if (!opts) opts = {};
var cache = b._options.cache; <---- here it fails
from blendid.
@antoniobrandao Check the watchify docs, it works differently now; you wrap a browserify instance, and that instance needs to be created with certain options.
from blendid.
This issue has been fixed in the latest version of Watchify, but requires Browserify 5.x, which at the moment is incompatible with browserify-shim. As soon as that's worked out, I'll update those dependencies all the way. I did update watchify to ~0.10.1, but I'm not sure if it's been fixed there or not.
from blendid.
@heyimalex How would that apply to @greypants "gulp-starter"? In his example, there is a check to see whether we are "watching" and only in that case use Watchify, otherwise use browserify - I think. (am I wrong?)
Does your implementation work like that? Perhaps you could give me a tiny example code? :)
Thanks
from blendid.
The new implementation works a little differently. You initialize browserify first, then wrap it with watchify. The updated task would look something like this (I think):
gulp.task('browserify', function() {
var bundler = browserify({
// Required watchify args
cache: {}, packageCache: {}, fullPaths: true,
// Browserify Options
entries: ['./src/javascript/app.coffee'],
extensions: ['.coffee', '.hbs'],
debug: true
});
var bundle = function() {
return bundler
.bundle()
.on('error', handleErrors)
.pipe(source('app.js'))
.pipe(gulp.dest('./build/'));
};
if(global.isWatching) {
bundler = watchify(bundler);
bundler.on('update', bundle);
}
return bundle();
});
The docs are kind of confusing, but I think that's right.
BUT until browserify-shim supports browserify 5.x, we're stuck on old watchify, which uses the method currently in this repo.
from blendid.
I think you are "watching" if you get that error. The fix needs to go in the gulp-starter browserify task; instead of switching between browserify and watchify based on the global watching flag, always use browserify, and then, if the watching flag is set, wrap browserify with watchify. Also, the options watchify requires need to be added to the browserify constructor.
Not familiar with gulp-starter, but had the same issue when I upgraded watchify a couple of weeks ago and my browserify task looked similar.
from blendid.
@greypants in that code line 14, "bundle" returns undefined because it is only declared afterwards.
Moved it around, seems to work fine. Using Watchify ~1.0.1.
Will stick to it because I'm not needing browserify-shim at the moment :) Thanks !
from blendid.
Oh, good call. I'll update the comment. No problem!
from blendid.
Related Issues (20)
- watch task will not compile more than 48 html files HOT 5
- Removing "comments" from public/html files HOT 1
- xlink:href being deprecated in SVG
- Additional Tasks information HOT 4
- Build issue: UglifyJs - Unexpected token: name (context)
- Build issue: UglifyJs - Unexpected token: name (context) HOT 5
- Fonts aren't copied over on build HOT 1
- additionalTasks access rev-manifest HOT 4
- Not bundle jquery in production HOT 1
- Current project status HOT 4
- 4.5.0 release not available through npm/yarn HOT 1
- Failed to mount component: template or render function not defined HOT 1
- upgrade to gulp 4
- empty prebuild and postbuild configs must be `null`/`false`, not `[]`. change this behavior?
- html watch task does not notice changes to files added after Blendid was started
- wrong generation of path for js-files in rev-manifest on windows HOT 1
- Configuration for swiper to work
- The engine "node" is incompatible with this module HOT 3
- 4.5.3 release not available through npm HOT 1
- ERROR in bundle.js from UglifyJs Unexpected token: name (ChangeDesc) [bundle.js:2900,6]
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blendid.