-
Notifications
You must be signed in to change notification settings - Fork 58
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
Not able to use standalone & require flags at the same time #45
Comments
I'd like to know the reasoning for this as well. Is there some reason a standalone bundle can't also export a |
At the moment, nobody's done the work to make those two things function together, so just removing the conditional would not be enough to make it work. How would the resulting code determine whether to set |
Simply by doing both things, so it's available as a global and by require(). |
@ForbesLindesay If I do the work can I expect it to be merged? |
Doing both things seems like a really dirty hack. You end up with a bonus global either way. |
That sounds like an indictment of standalone mode in general. How is it a dirty hack to also export a
You mean you end up with the global created by standalone mode either way? |
In the plugins scheme we are using at my work, it's a valid use case, since our librare can be used standalone, but at the same time the third party plugins would want to require() its resources. It's a worst hack to explicitly expose it globally as we need to o at this moment... |
I'm happy you think so :-) The hack we are currently using at my job is to have a /**
* Loader for the kurento-client package on the browser
*/
if (typeof kurentoClient == 'undefined')
window.kurentoClient = require('kurento-client'); Later, we generate a non-standalone browser library exporting |
How do you figure? Currently when doing standalone you can't get the Standalone is currently an explicit opt-in mechanism. Exposing files from bundles with a global When doing standalone, then also doing /* Bundle A */
browserify()
.require('whatever', {expose: 'ModuleName'})
/* Bundle B */
browserify({
standalone: 'ModuleName'
}) <script src="bundle-a.js"></script>
<script src="bundle-b.js"></script> |
PR #51 submitted. |
As notified at browserify/browserify#939, I'm not able to generate a bundle that at the same time can be used standalone and also export its content so it can be required by other bundles, that it's useful for frameworks that can use build-in and external plugins at the same time. Reviewing the code, there's a conditional that explicit forbit this use case, so I would like to know if it's on purposse and why, or if this could be fixed for this use case (I think it's possible, but needs to investigate a little bit more the code...).
The text was updated successfully, but these errors were encountered: