plugins icon indicating copy to clipboard operation
plugins copied to clipboard

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

Open htho opened this issue 1 year ago • 0 comments

  • Rollup Plugin Name: [@rollup/plugin-swc]
  • Rollup Plugin Version: 0.3.1
  • Rollup Version: 4.18.0
  • Operating System (or Browser): Chrome 128 (for example)
  • Node Version: 20.11.0
  • Link to reproduction (⚠️ read below): https://stackblitz.com/edit/rollup-repro-2kplmm?file=src%2Fmain.js

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. .

htho avatar Jun 10 '24 08:06 htho