rollup / rollup-plugin-babel

This package has moved and is now available at @rollup/plugin-babel / https://github.com/rollup/plugins/tree/master/packages/babel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Supporting babel syntax plugins

detj opened this issue · comments

Babel supports syntax plugins, allowing babel to parse the syntax without transforming the code. But rollup-plugin-babel always transforms by default.

For example, for the following babel config

babel.config.js

module.exports = {
  plugins: ["@babel/plugin-syntax-jsx"]
}

running rollup -c throws Error: Unexpected token when babel encounters jsx code. I understand, that transforming code is probably the reason why anyone might be using this plugin, but there could be cases where a transform is not desired. Babel does support using only syntax plugins. That way, the full range of babel's functionality is supported.

What are your thoughts on this ?

If Babel doesn't transform JSX, it will give rollup code containing JSX and rollup can't understand it.

I see. thanks for the quick answer @nicolo-ribaudo