Skip to content

@babel/plugin-proposal-decorators not working with @babel/plugin-transform-runtime #9454

@Lodin

Description

@Lodin

Bug Report

Current Behavior
Decorator helpers are not imported if @babel/plugin-transform-runtime is enabled, instead, they are still defined in file as if no transform-runtime plugin is used.

Input Code

@cls
class A {
  @prop
  test() {}
}

Expected behavior/code
All helper functions in the file are replaced with imports from @babel/runtime.

Babel Configuration (.babelrc, package.json, cli command)

{
  plugins: [
    [require("@babel/plugin-proposal-decorators"), {decoratorsBeforeExport: true}],
    require("@babel/plugin-proposal-class-properties"),
    [require("@babel/plugin-transform-runtime"), {
      "corejs": false,
      "helpers": true,
      "regenerator": false,
      "useESModules": true
    }],
  ],
  presets: [],
}

Environment

  • Babel version(s): 7.2.2
  • Node/npm version: node 11.8.0/npm 6.5.0
  • OS: Windows 10
  • Monorepo: [e.g. yes/no/Lerna]: no
  • How you are using Babel: [e.g. cli, register, loader]: cli

Additional context/Screenshots
Add any other context about the problem here. If applicable, add screenshots to help explain.

I can find @babel/runtime/helpers/esm/decorate.js file in node_modules, so only import replacing doesn't work for some reason.

Metadata

Metadata

Assignees

No one assigned

    Labels

    outdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions