Skip to content
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

pica 6 breaking browserify build with browser-pack-flat plugin #197

Closed
greghuc opened this issue Jul 6, 2020 · 4 comments
Closed

pica 6 breaking browserify build with browser-pack-flat plugin #197

greghuc opened this issue Jul 6, 2020 · 4 comments

Comments

@greghuc
Copy link
Contributor

greghuc commented Jul 6, 2020

Hi there,

On upgrading to pica 6 (from 5.3) I am seeing "Uncaught ReferenceError: require is not defined" on my production browserify build. I have tracked the problem to browser-pack-flat, which is used by tinyify to minify the build.

browser-pack-flat says it "rewrites require() calls to simple variable assignments. If a module wraps require() somehow it probably will not work. In practice this is quite rare.".

Could you please explain what changed with the browserify build in pica 6, and whether it is rewriting require calls? Is this a hack? I am wondering whether there is an alternative approach to the recent changes that would fix this new ReferenceError.

I can actually avoid the ReferenceError by configuring tinyify not to use browser-pack-flat, but it does mean that the build files will be slightly larger.

And thanks again for pica :-)

Greg

@puzrin
Copy link
Member

puzrin commented Jul 6, 2020

See d34e1db

It now uses "compiled" file as main entry, and derequire to allow browserify external packages. For eample, https://github.com/nodeca/image-blob-reduce build will fail without derequire.

@greghuc
Copy link
Contributor Author

greghuc commented Jul 6, 2020

OK thanks - I've noted that pica is breaking with browser-pack-flat at: goto-bus-stop/browser-pack-flat#39

@puzrin
Copy link
Member

puzrin commented Jul 6, 2020

I think, you need report to appropriate repos, this is not pica issue.

@puzrin puzrin closed this as completed Jul 6, 2020
@greghuc
Copy link
Contributor Author

greghuc commented Jul 6, 2020

Agreed, and thanks for the quick reply. Greg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants