When using @rollup/plugin-babel with @rollup/plugin-commonjs in the same Rollup configuration, it's important to note that @rollup/plugin-commonjs must be placed before this plugin in the plugins array for the two to work together properly. e.g.
In a different project bundled with rollup, I had to place commonjs()afterbabel(), contrary what was recommended, because otherwise I would have got a syntax error for the pipeline operator, originating from @rollup/plugin-commonjs.
I get a syntax error when I try to use the pipeline operator
|>
in a test fileHow to reproduce
Create a new project with just 3 files in it:
test.js
.babelrc
package.json
run
npx ava
:debugging
The problem can be "fixed" like so:
"type": "module"
from package.jsonimport
by arequire
in the test fileideas
It reminds me of this, from the @rollup/plugin-babel doc