Open mnoble01 opened 8 years ago
Hello @mnoble01. The error goes away if you just remove Pathmodify and leave everything else as-is? If that's the case, it suggests that Browserify thinks your module is in node_modules/
when using Pathmodify (not sure how that would happen though).
I'm wondering if it's just the order of transforms/plugins
That could be the issue in some cases, because a plugin can add a transform, but Pathmodify doesn't currently.
or if the pathmodify plugin is wrongly parsing the erroring file in ES6 instead of from the stream
It's definitely not that: Pathmodify doesn't parse files it all, it just affects Browserify's module path resolution behavior.
I'm not exactly sure off the top of my head how Pathmodify would interact with the paths
config. For an experiment you could try setting your target like this:
var path = require('path');
pathmodify.mod.id(
'underscore',
path.join(__dirname, 'app/shared/lib/underscore-extend')
)
FWIW, the way the Node module system works, you should be able to just invoke your script that extends Underscore from your entry point, not have it export anything, and just import Underscore from your other modules since it should be the same object (although it looks like you have Underscore in vendor/underscore
and would need to rewrite imports of underscore
somehow anyway?).
Can you create a repo with a minimal reproduction?
By the way, I'd like to ask you a question about your usage of Pathmodify off GitHub and I'd appreciate if you would get in touch with me here (please make sure to include contact information).
I'm getting this error when using pathmodify.
What I'm trying to do is alias an
underscore-extend
for all calls torequire('underscore')
(orimport 'underscore'
in ES6). The reason for this is I'm mixing in some of my own functions to underscore and I'd like them to be available anywhere underscore is required in my codebase.Here's my underscore-extend.js:
And my gulpfile:
I'm wondering if it's just the order of transforms/plugins or if the pathmodify plugin is wrongly parsing the erroring file in ES6 instead of from the stream. Or something else I'm not even thinking of.