Skip to content

Use of transform-runtime + proposal-decorators plugins causes Maximum call stack size exceeded #9127

@purtuga

Description

@purtuga

Bug Report

Current Behavior
The use of @babel/plugin-proposal-decorators together with @babel/plugin-transform-runtime generates a bundle that causes a infinite loop (around _typeof() and _typeof2() eventually causing the browser to throw Uncought RangeError: Maximum call stack size exceeded.

If I remove transform-runtime from the configuration, the bundle generated does not emit any errors.

Input Code

  • REPL or Repo link if applicable:
class Foo {
    @propDecorator
    get method1() {
        return  "one";
    }
}

function propDecorator(d) {
    return d;
}

Expected behavior/code
The transformed code should not cause an infinite loop

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

{
    "test": {},
    "loader": "babel-loader",
    "options": {
        "babelrc": false,
        "presets": [
            [
                "@babel/preset-env",
                {
                    "modules": false,
                    "loose": false,
                    "forceAllTransforms": true
                }
            ]
        ],
        "plugins": [
            [
                "@babel/plugin-transform-runtime",
                {
                    "corejs": false,
                    "helpers": true,
                    "regenerator": true,
                    "useESModules": true
                }
            ],
            [
                "@babel/plugin-proposal-decorators",
                {
                    "legacy": false,
                    "decoratorsBeforeExport": true
                }
            ]
        ]
    }
}

Environment

  • Babel version(s): 7.2.0
  • Node/npm version: Node v8.9.0, NPM v5.5.1
  • OS: Windows
  • Monorepo No
  • How you are using Babel: Loader (webpack)

All packages:

    "@babel/core": "^7.2.0",
    "@babel/plugin-proposal-class-properties": "^7.2.1",
    "@babel/plugin-proposal-decorators": "^7.2.0",
    "@babel/plugin-transform-async-to-generator": "^7.2.0",
    "@babel/plugin-transform-runtime": "^7.2.0",
    "@babel/preset-env": "^7.2.0",
    "@babel/runtime": "^7.2.0",
    "babel-loader": "^8.0.4",
    "webpack": "^4.27.0",
    "webpack-cli": "^3.1.2"

Thank you in advance for your help/assistance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    i: needs triageoutdatedA 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