Tree shaking with webpack

I’m using webpack to bundle my app(cannot move, as started off from CRA and would love to enjoy it) - The most popular bundler for the browser.

It seems like rescript generates es6 imports always with “import * …”
As far as i can tell this doesnt play well with webpack tree shaking.

Is rescript not tree-shaking friendly?

wildcard imports should be fine with tree shaking afaik. do you have an example when it doesn’t play well ?

hmm, i’ll try to produce minimal example. but from what i read, webpack v4 doesnt support that.

I use ReScript with esbuild and when I switched from commonjs to es6 output my bundle size went from 1.9MB to 700KB. So at least esbuild can handle the imports ReScript uses for tree shaking.