-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Errors building with browserify / watchify (0.3.4) #105
Comments
Hmm, yeah. I think you may be right. When you do add them as |
It works when I add them to If I hack them into my |
I don't get it, where in our code are we requiring browserify-shim? |
browserify-shim works by reading the |
It's in
|
Ah yes, I just figured that out. That's dumb, these are simply for us to create a build for bower, not to screw up your build.
@mjackson any opinions? I'd script 2 so we'd still just do |
(btw, webpack works fine, ofc, because it doesn't think it needs to use the shim) |
Seems like it's a good idea to add Unless I'm mistaken, envify would be just as useful for custom browserify builds, wouldn't it? Means anyone managing their own browserify process doesn't need to know to include it as a filter. I assume this is why React has it as a dependency and a transform, but I'm a bit new to both. (on a related note, seems like it would be safe to upgrade to envify 2.0.1, the only breaking change was supporting getter properties in custom environment objects - see hughsk/envify@624b03c)
|
I think it just does this everywhere we require react:
Which is not enough to worry about, but maybe that's terrible because we aren't getting the normal react from node_modules :\ |
I think we can specify the transforms in the build script instead of package.json so that they're used only when making the router browser builds. |
Yeah, that's what I hope to do tomorrow morning. Sent from my iPhone
|
Okay, so I spent some time this morning figuring this out. For building it will be fine to move the transforms from package.json to the build script. The result is the same. Where it differs is when you're using browserify to create a build of your own project that requires the router. In that case, the Seems like when you're using browserify it's all or nothing. |
@mjackson What is your problem? Does |
@th0r No, it only includes React once. But I want to use CDN-hosted React. |
For reference, here's a branch that removes |
@mjackson So, why can't you just add "browserify-shim": {
"react": "React"
} |
@th0r I am. Trouble is I need to add Anyway, I think I've figured it out now thanks to @rpflorence. Let's go ahead and move the transforms to the build script. |
@mjackson alternatively you should be able to exclude React from your build by following the instructions here: https://github.com/substack/node-browserify#multiple-bundles @rpflorence does ReactRouter actually have any code branches that are excluded by |
@JedWatson The |
@mjackson aaah right, of course. Thanks for fixing this up :) |
I'm getting the following errors when building with gulp and browserify / watchify:
(clipped project path for brevity)
I've got both
react
andreact-nested-router
declared in my mainpackage.json
file:The issue seems to be that
npm install
doesn't install thedevDependencies
from modules, only the mainpackage.json
.To resolve it I can either (a) run
node install
from my project's/node_modules/react-nested-router
folder, or (b) declareenvify
andbrowserify-shim
asdevDependencies
in my mainpackage.json
(this creates a version conflict though as react wants"envify": "^2.0.0"
and the router wants"envify": "~1.2.0"
)React declares
envify
as a normal (not dev) dependency:... which works fine, perhaps
react-nested-router
could do the same withenvify
andbrowserify-shim
?The text was updated successfully, but these errors were encountered: