Comments (16)
Hmm, I couldn't reproduce that error with Node v0.10.24, gulp 3.5.2, gulp-util 2.2.14, gulp-browserify 0.4.4 and d3 3.4.1.
@ragle Did you try rm -rf node_modules
and npm install
again?
from gulp-browserify.
Try clearing your npm cache.
from gulp-browserify.
@shuhei thanks for checking!
I did try that, without luck.
I'll rebuild node when I'm back at my machine first thing in the morning at 0.10.24
, though I suspect it's something else wonky with my system / env...
Cheers.
from gulp-browserify.
@ragle use n or nvm to manage multiple node versions
from gulp-browserify.
@deepak1556 - thanks!
Still no luck after clearing the cache or trying with different versions of node via n. Even with a complete re-install of everything from source, no dice.
Still only happening with d3. Testing with 3 other modules:
//successfully load underscore
var _ = require('underscore');
console.log(_.indexOf([5], 5)); // logs: 0
//successfully load jquery
var $ = require('jquery');
console.log($.inArray(5, [5])); // logs: 0
//successfully load backbone
var bb = require('backbone');
var mod = new bb.Model(); mod.set({foo: 5});
console.log(mod.get("foo")); // logs: 5
// fail
var d3 = require('d3');
console.log("This won't run");
I've got to run, but I'll be home later and will work on this some more. Will try to investigate why loading d3 is so problematic on my system.
Thanks.
from gulp-browserify.
I think it's worth trying browserify command. If it fails too, it would be an issue on browerify itself or d3's CommonJS support. Then you'll get better feedbacks at those Issues pages.
from gulp-browserify.
@shuhei - Thanks - I should have mentioned in the initial report that everything is working fine with the browserify cli tool.
Since you can't reproduce my bug I'm going to close this. It could be an environment related streams issue or some other quirk. In any case - I think the problem is much deeper in the dependency tree.
Below are some notes (and a quick fix) that might prove helpful if anyone else ends up in a similar situation / arrives here via google.
Notes
I think the problem is somewhere in module-deps, specifically, mine.
Quick fix: Using the current version of gulp-browserify
but rolling its browserify
dependency back to 3.24.8
fixes the problem.
In 3.24.9
, browserify depends on module-deps@~1.4.0.
In 1.4.1, module-deps swaps out detective for mine.
If I run [email protected]
with [email protected]
(instead of ~1.4.0
), this also solves the problem. Then, it seems like the issue can be isolated to mine
....
I had a trivial go at debugging the problem, and it seems like mine
is returning an empty array to module-deps
on one of of its passes through d3
(and d3-browserify
, incidentally).
Unfortunately it's too late and I'm too tired to try to pin down an edge case for an FSM parser and the code that depends on it. :)
Will come back to this later and file an issue against one of those repos if I can offer something more substantial.
Thanks.
from gulp-browserify.
@ragle Thanks for your detailed note! #54 seems to be related to this issue. One of the difference between this plugin and the command line is that this plug passes full file path to browserify. So I suspect file path.
Let me ask one more question. What OS did you use when this issue happened?
from gulp-browserify.
@ragle Sorry for the mess, but I missed that the error occured on a browser. Now I can reproduce it on my Mac.
It's weird to see our machine's absolute paths in bundled scripts. I guess the new module-deps or mine is doing something wrong with paths. I'll look into it this weekend.
from gulp-browserify.
@shuhei, no worries! I'm running 64-bit Ubuntu 13.10.
It looks like Mine simply gets whatever is in between " "
or ' '
after it finds a require
followed by (
. Maybe the npm modules themselves are creating absolute paths when they are installed and nothing in the plugin is dealing with that before bundling?
Anyway - I think (but am not sure) that the issue could be in mine somewhere. When I debugged what detective (the module that mine replaced) was returning to module-deps - it was a collection with 9 dependencies. When I debugged what mine was returning - It was an array of 8 dependencies and an empty array.
I've got final exams and projects next two weeks at school, but if no one's found anything by then I'll have some time to hack on this too. :)
Thanks!
from gulp-browserify.
Might be related:
They say it's already fixed. I'll check out later today.
@ragle Good luck in your exams and projects!
from gulp-browserify.
I believe this pull request to mine
will fix this issue. Thanks @ragle, your notes were very helpful.
from gulp-browserify.
Also, I figured out that the cli tool was working because its --insert-globals
option was not working.
Hope everything will be fixed soon ð
from gulp-browserify.
For the time being, turning off insertGlobals
option will make it work. It will not affect the performance much because detecting globals is much faster than before thanks to mine
.
from gulp-browserify.
Nice! Thanks @shuhei for taking the time to look in to this and submit a solution! :)
from gulp-browserify.
@shuhei thanks for looking into this ð
from gulp-browserify.
Related Issues (20)
- Drop gulp-util dependency HOT 1
- During Bundling: Error: react-router-dom/NavLink.js: Line 48: Invalid regular expression HOT 1
- Externalizing shim to config suggestion?
- debowerify seems to prevent `.external()` from working HOT 1
- 'Uncaught Error: Cannot find module 'function e(t,n,r)... HOT 4
- browserify+ coffeeify+ preprocess cannot work right.Here's my gulpfile.
- node_modules being included HOT 3
- Error: need proper browserify instance, on windows machine HOT 2
- ignore do not support the relative path
- babelify 7.2.0 doesn't work fork
- [email protected] doesn't work in gulp-browserify
- How to do files: multiple sources to new file like grunt HOT 1
- Help options transform babelify
- how can i user that module like this?
- Unexpected reserved word (mounted) for Vue.js
- 'nobuiltins' options is not working in certain circumstances
- Unexpected token => HOT 3
- įžčŊ æĨé
- Cede the package name on NPM to gulp-bro HOT 9
- ParseError: 'import' and 'export' may only appear at the top level
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 gulp-browserify.