vitejs / vite-plugin-react-swc

Speed up your Vite dev server with SWC
MIT License
834 stars 54 forks source link

Bundle size issue with library mode #32

Closed ArnaudBarre closed 1 year ago

ArnaudBarre commented 1 year ago

Reported by @vaibhavshn on Discord

I can see a development react-jsx-runtime.development.js being injected into build output in v4

Repro: https://github.com/vaibhavshn/vite-react-swc-test

ArnaudBarre commented 1 year ago

@vaibhavshn I'm able to reproduce the issue. It also happens with vite 3 and the babel plugin v2.

Using external: ["react", "react/jsx-runtime"] or classic runtime with the Babel plugin fixes the issue.

The fact that both and dev version are bundled seems ok because NODE_ENV is not set when bundling for libs, and this can allow to publish libs with both dev and production mode.

So I think this is working as intended

vaibhavshn commented 1 year ago

Yes, this was it. Thanks @ArnaudBarre!