Skip to content

order of @rollup/plugin-commonjs and @rollup/plugin-babel #1386

Closed

Description

@tjx666

Versions:

"rollup": "^3.7.5"
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-commonjs": "^24.0.0",

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:

rollupPluginCommonjs(),
            rollupPluginCommonjs(),
            rollupPluginBabel({
                // runtime 需安装 @babel/runtime
                babelHelpers: 'bundled',
                exclude: '**/node_modules/**',
                configFile: options.babelConfigPath || false,
                extensions: [...DEFAULT_EXTENSIONS, '.ts', '.tsx'],
            }),

But when parse a js with decorator, occur error:

[!] (plugin commonjs--resolver) SyntaxError: Unexpected character '@' (9:0) in /Users/yutengjing/code/editor-next/packages/editor/chart-render/src/charts/column/index.js
src/charts/column/index.js (9:0)
 7:  * @class Column
 8:  */
 9: @DimensionRevise(TwoDimension)
    ^
10: export default class Column extends BaseColumn {
11:     getDefaultModel() {
SyntaxError: Unexpected character '@' (9:0) in xxx/yyy.js

Why documentation note @rollup/plugin-commonjs must before @rollup/plugin-babel? Any problems If I reverse their order?

Activity

  1. locked and limited conversation to collaborators on Dec 22, 2022
  2. converted this issue into a discussion #1387 on Dec 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions