-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: Cannot read property 'source' of undefined #30
Comments
@cowwoc could you please include the bundled output from browserify that's breaking here? I need to be able to reproduce it on my machine to be able to help with this one. |
@hughsk Please email me at [scrubbed] and I'll send you the bundle privately. |
got the same issue here too |
here too :( |
If you are on windows, you will likely need to do a It seems as though browserify doesn't do it for you : / A working Example (for me):
Full code here. Go to localhost:3000/fresh or localhost:3000/disk An alternative is Btw, if theres ever an issue with file loading and you're on windows:
|
This still happens to me even after using Here's the gulp task: var gulp = require('gulp');
var config = require('../config');
var browserify = require('browserify');
var open = require('opener');
var disc = require('disc');
var fs = require('fs');
gulp.task('build:disc', function() {
var output = config.destDirectory + '/disc.html';
var bundler = browserify(config.sourceDirectory + '/' + config.sourceEntry, {
fullPaths: true
});
bundler.bundle()
.pipe(disc())
.pipe(fs.createWriteStream(output))
.once('close', function() {
open(output);
});
}); |
@nemo are you on windows? |
@formula1 Nope - OSX. |
What is the value of config.souceDirectory + "/" config.sourceEntry? I've been able to get this running on multiple systems so I was hoping it was a windows only issue |
Here's how config is defined: var config = {};
config.destDirectory = "./dist";
config.sourceDirectory = "./app";
config.sourceEntry = 'index.js'; And in case it's helpful, here's the versions for what I'm using: {
"browserify": "^9.0.7",
"disc": "^1.3.2",
"gulp": "^3.8.11",
"opener": "^1.4.1"
} |
I'm sorry if that is confusing, not sure the best way to explain. |
In index.js#L91, you can resolve var byid = modules.reduce(function(memo, mod) {
var id = (function(id) {
if (path.resolve(id) !== path.normalize(id)) { // check for relative path
return path.resolve(process.cwd(), id); // resolves "id" to an absolute path
}
return id;
}(mod.id));
memo[id] = mod;
return memo
}, {}) I'm not sure if above code example may cause any side effects, but it did fix my issue even if using a relative path. |
Ah I see. Yeah, using |
You probably don't need normslize btw, that's usually a windows issue. Mac and Linux can generally path as freely as they like so long as the code base isn't going to be shared to windows |
Without |
Ah, makes sense. |
With @cheton his patch, it also fixed it in our setup! |
@cheton patch worked for me too |
This issue is a variation of #24 (same error but I use absolute paths).
add()
anddest()
) with absolute paths.This issue is reproducible 100% of the time.
The text was updated successfully, but these errors were encountered: