-
Notifications
You must be signed in to change notification settings - Fork 13
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
ReferenceError: require is not defined #39
Comments
forgot about this and tried upgrading tinyify, can confirm this is still an issue 😢 |
Can you recommend a workaround? It seems like we're an isolated case since I haven't seen this getting reported by anyone else. Is our build setup very unusual?
|
sorry taking a while to refresh my memory, I remember now that the issue is with the standalone browserify bundle of |
FYI I've seeing a similar "Uncaught ReferenceError: require is not defined" on using tinify+browser-pack-flat with https://github.com/nodeca/pica version 6.0.0 (it worked on the previous pica 5.3.0). I asked the pica author what had changed, and he said: "It now uses "compiled" file as main entry, and derequire to allow browserify external packages". See nodeca/pica#197. For now, I'm avoiding the error by running tinify with "flat: false" option which uses bundle-collapser rather than browser-pack-flat. Now my minified js is 32KB larger.. |
seems simply to browserify a browserified module can cause this problem. a.js:
b.js:
build script:
include Accidentally encountered this when building something while forgot adding |
@ungoldman found a problem with the change in #38:
browserify standalone bundles do
…which now breaks.
not sure what the best fix is, but it might be enough to simply add a check for the
&& require
bit—default browserify and browser-pack-flat both use that pattern for external requires and we shouldn't muck with it. Worth checking out what webpack does (though i would guess they don't actually check for externalrequire
at all)The text was updated successfully, but these errors were encountered: