Using Browserify and RequireJS on the same page?
See original GitHub issueSo i’ve come across an interesting use case where i’m using Browserify to bundle all of my assets together in a project, but a large external (external to the project) module needs to be loaded in when a certain in-app window is accessed. (It’s a video player module made up of three scripts that get pulled in asynchronously when required).
At the moment i’m getting all kinds of errors from uncalled object
errors if the requireJS module is loaded in before the Browserified app.js file, to cannot find module
errors if loaded in after the Browserified code.
Is there anyway i can get Browserify and RequireJS to play nicely on the same page? I’m losing my mind!
Issue Analytics
- State:
- Created 9 years ago
- Reactions:3
- Comments:18
Top Results From Across the Web
Using Browserify and RequireJS on the same page?
So i've come across an interesting use case where i'm using Browserify to bundle all of my assets together in a project, but...
Read more >Is it possible to use Browserify and RequireJS on the same ...
I'm really only just getting the hang of modular coding. Browserify is really nice, and is quite easy to get up and running...
Read more >Javascript – Using Browserify and RequireJS on the same page ...
So i've come across an interesting use case where i'm using Browserify to bundle all of my assets together in a project, but...
Read more >A Journey From Require.js to Browserify - Orizens
Require.js has support both for the AMD & CommonJS specs for module definition as well as for loading incompatible files with these specs....
Read more >Browserify Tutorial - Using require() In The Browser - YouTube
Learn how to use the require() function to import Javascript modules in the front-end part of your web application ( in the browser)...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We had a similar problem, using the
--standalone
option. If a user was using requirejs, our module would never reach thewindow
, thus making a few web components that needed to access the library throughwindow
unusable.Our fix was to remove the AMD module check and let browserify assign the variable to
window
. https://github.com/expandjs/expandjs/commit/32765905ea2cb0815f115867e11db192856541e5You can avoid the conflict by changing your AMD code to use the
requirejs
global rather than therequire
global, and only have the Browserified code userequire
. This solution worked for me for having AMD modules and Browserified modules on the same page.