Fork me on GitHub
#shadow-cljs
<
2022-08-14
>
thheller07:08:15

@john 2.19.9 should respect the push-state headers properly

🎉 1
🙏 1
tianshu22:08:01

Does this work with tree-shaking? Is there a chance that some functions are used, but not seen by webpack?

tianshu22:08:19

Since it only provides a require statement.

thheller22:08:10

not currently no

thheller22:08:07

in theory its possible to generate precise import that should be tree-shakable but its a lot of work

tianshu22:08:32

So this ALL will refer everything

thheller22:08:23

ALL is just a variable name and means nothing

thheller22:08:49

webpack tree-shaking just works off import and not require

tianshu22:08:13

If some libraries are designed with tree-shaking, parts of code will be missed with this method?

thheller22:08:13

tree-shaking will not work at all, nothing will be eliminated. webpack just can't

tianshu22:08:39

Does shadow-cljs handle the polyfills? like buffer in browser

thheller22:08:15

shadow-cljs also doesn't tree-shake any npm dependencies, so the end result is the same regardless of what you use

thheller22:08:47

it does polyfill when it processes npm packages yes, not when using :js-provider :external

tianshu22:08:04

Ah, I see. What does the pollyfill actually do? Let's say I need buffer in browser, without :js-provider :external, it works with buffer in dependencies. But when I switch to :js-provider :external, Buffer is not defined.

tianshu22:08:09

So I have to do something?

thheller22:08:50

:external means shadow-cljs doesn't process ANY npm packages. whatever you use to process the :external-index (eg. webpack) will do that instead

thheller22:08:00

and newer webpack no longer provides those polyfills by default

thheller22:08:06

so you need to configure webpack to provide it

tianshu22:08:13

yep, I knew webpack5 doesn't provide it

tianshu22:08:07

Thank you!

tianshu22:08:20

Now, it works to me

tianshu22:08:34

JavaScript is so complex