rollup / plugins

🍣 The one-stop shop for official Rollup plugins
MIT License
3.57k stars 567 forks source link

[@rollup/plugin-swc] leads to unusable bundle in combination with [@rollup/plugin-commonjs] and [@rollup/plugin-node-resolve] #1736

Open htho opened 3 weeks ago

htho commented 3 weeks ago

Expected Behavior

❯ npm run build
❯ node dist/main.js
e

Actual Behavior

❯ npm run build
❯ node dist/main.js
Error: $$4 is not a function
    at _evaluate (https://rolluprepro2kplmm-cpe3.w-corp-staticblitz.com/blitz.c3e5e364.js:40:786736)

Node.js 18.20.3

Additional Information

The alternative build with an alternative source file produces correct results.

❯ npm run build:alt
❯ node dist/main-alt.js
e

src/main-alt.js already includes the imports that are added by swc. Therefore swc is skipped. .