Now suppose that I want to lazy load b.js. If I browserifya.js with factor-bundle, b.js's content will end up in common.js. One workaround is changing a.js to something like this:
Now b.js will not be included in common.js and will be in its own bundle. The problem is the require function in a.jsdoesn't know about './b.js' now so it fails to require it.
Questions:
Is it possible to make the require in a.js aware of the id associated with './b.js'?
Generally is it the good approach? What are the best practices for achieving this?
P.S. https://github.com/epeli/browserify-externalize seems to try to solve this issue, but it's not maintained anymore.
Suppose that I have:
Now suppose that I want to lazy load
b.js
. If Ibrowserify
a.js
withfactor-bundle
,b.js
's content will end up incommon.js
. One workaround is changinga.js
to something like this:Now
b.js
will not be included incommon.js
and will be in its own bundle. The problem is therequire
function ina.js
doesn't know about './b.js' now so it fails to require it.Questions:
require
ina.js
aware of the id associated with './b.js'?P.S.
https://github.com/epeli/browserify-externalize
seems to try to solve this issue, but it's not maintained anymore.