Repository navigation
Replies: 1 comment
|
For the versions in the question, you can keep the documented order and exclude your ES-module source from the CommonJS pass: plugins: [
commonjs({ exclude: ['src/**/*.js'] }),
babel({
babelHelpers: 'bundled',
exclude: '**/node_modules/**',
// Keep your existing Babel config, including the decorator transform.
configFile: options.babelConfigPath || false,
extensions: [...DEFAULT_EXTENSIONS, '.ts', '.tsx']
})
]Adjust that pattern to your source layout. Only exclude files that do not need CommonJS conversion; if your own source contains The error occurs before Babel gets to transform the decorator: CommonJS analyzes the file using Rollup's parser. In those versions, that parser rejects I reproduced the Reversing Babel and CommonJS also passed that small fixture, so it isn't inherently invalid for every input. The documented order ensures Babel processes the result of CommonJS conversion too. Filtering the decorated ESM files avoids changing that order for the dependencies that need both plugins. |
Uh oh!
There was an error while loading. Please reload this page.
Versions:
I read the doc: https://github.com/rollup/plugins/tree/master/packages/babel#using-with-rollupplugin-commonjs, and put @rollup/plugin-commonjs before @rollup/plugin-babel like following:
But when parse a js with decorator, occur error:
Why documentation note
@rollup/plugin-commonjs must before @rollup/plugin-babel? Any problems If I reverse their order?All reactions