You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We've recently bumped into this issue when upgrading from version 4 to versions 5 and beyond. In our project, we're using backbone, which has a dependency on underscore, but in our other files we're using lodash as a dependency.
Since we don't want to ship both to the client, we decided to do an alias for lodash to underscore. However, this browserify -r lodash:underscore is now breaking on new versions of browserify.
this does work to a certain extent, but I cannot use require ('lodash') because browserify never exposes the package.
Another solution was proposed by @terinjokes in his blog post, but this requires me to add additional details to my package.json. I don't think that this is the proper solution.
My proposition is to have the .require() method in browserify support an array for multiple expose names. This way, require('lodash') and require('underscore') will both resolve to underscore.
I was wondering if you are open to a pull request that implements this?
The text was updated successfully, but these errors were encountered:
there are plugins for this, but that doesn't change the fact that this was supported in 4.2.x. and is no longer supported now. transforms make the build very very slow, as well so id like browserify to expose multiple things.
aliasing requires is still broken though you cannot do something like browserify -r underscore:lodash because it will break. I think i'll write a failing test case for that.
We've recently bumped into this issue when upgrading from version 4 to versions 5 and beyond. In our project, we're using backbone, which has a dependency on underscore, but in our other files we're using lodash as a dependency.
Since we don't want to ship both to the client, we decided to do an alias for lodash to underscore. However, this
browserify -r lodash:underscore
is now breaking on new versions of browserify.I've tried multiple solutions for this:
I tried the solution posted in Can't defined exposed name with require option #881 (comment) by using
browserify -r ./node_modules/lodash:underscore
this does work to a certain extent, but I cannot use
require ('lodash')
because browserify never exposes the package.Another solution was proposed by @terinjokes in his blog post, but this requires me to add additional details to my package.json. I don't think that this is the proper solution.
My proposition is to have the
.require()
method in browserify support an array for multiple expose names. This way,require('lodash')
andrequire('underscore')
will both resolve to underscore.I was wondering if you are open to a pull request that implements this?
The text was updated successfully, but these errors were encountered: