Closed benoitguigal closed 9 years ago
+1 for this
React takes a lot of time to compile (although I'm seeing avg. 6 seconds on a newish macbook air, not 30)
browserify-middleware will wait until the bundle is built before serving it, whether its built on demand or precompiled (i.e. if you precompile but then immediately request the bundle, you'll experience the same wait)
Are you sure this isn't working as expected? To verify:
/bundles/shared.js
. However long it takes (30s) is your baseline/bundles/shared.js
. If it takes another 30s, this is a problem. If it is served immediately, precompile is working as expected.I am experiencing the same issue – the bundle is definitely not being precompiled, even when setting { cache: true, precompile: true }
explicitly.
app.get('/bundle.js', browserify('./browser.js', { cache: true, precompile: true }));
As far as I can scry from reading the source, caching the output happens in the send.js
file, but the precompile option calls the compile
module which does not touch this cache. I may be entirely missing how this works though :-)
If you point me in the right direction I'd be happy to provide a PR if I find a fix.
+1 as I've noticed this issue on Heroku which has 30s request timeout. Is there a workaround?
This should now be fixed in latest, in fact precompile is completely un-necessary now because we pre-compile everything (except folders).
I am using browserify-middleware in production with NODE_ENV='production'. According to the documentation,
precompile
should be set totrue
. However, my first request after server start up takes a lot of time (~30s to serve/bundles/shared.js
). Here is my code :does it have something to do with requiring external libraries ?