Comments (14)
@defunctzombie @TooTallNate browserify masters, how to best handle this? are we still doing try/catch's?
from clone.
Well my solution is add-component-symlinks
, to fix the npm vs. component "require" name discrepancy.
The try/catches must not be in place in order to work with browserify.
from clone.
The following setup should work with node, browserify, and component.
Assume package.json is published as foobar-component
and component.json is foobar
try {
var module = require('foobar-component');
}
catch() {
var module = require('foobar');
}
Package.json needs to have the following
"browser": {
"foobar": "foobar-component"
}
This will allow browserify to not bork on the foobar
require (since it tries to resolve at build time). And it will allow node to work because it will find foobar-component
via normal node_modules lookup.
If you don't need to support node and just want to support component and browserify, the js is simpler.
var module = require('foobar');
Hope that helps clear up how to support all three environments.
from clone.
Huh... hacky, but clever. I wish there was a way to avoid all the try/catching in the actual script file though :( (ya, I like when they work in node as well. all 3)
from clone.
Having try/catch
all over the place is really painful :(
from clone.
changed it to component-type
:D 0.2.1
it's also component-clone
now.
from clone.
require('component-type')
doesn't work for me using component. Why is that?
from clone.
gah it doens't work? is the current builder broken?
from clone.
doesn't work with 0.10.x. I haven't tried 0.12.0 or builder2 so I don't know about those ones.
from clone.
k i'll change it
from clone.
man but i don't want to. all the solutions are ugly
from clone.
this is what happens when you create two package managers and one of them doesn't have namespaces.
Reality.
from clone.
+1 to reality, I got bit by this today (also [email protected]) :(
from clone.
k pushed again -___-
from clone.
Related Issues (4)
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 clone.