Skip to content

Decorators plugin throws error in ie 11 #9999

@quetzalsly

Description

@quetzalsly

Bug Report

Current Behavior
ie 11 fully fails with throw new TypeError("@@toPrimitive must return a primitive value.")}

Input Code

@customElement('test')
class TestApp extends connect(store)(LitElement)
{
  @property({ type: String }) _Test = 'Hello';

Expected behavior/code
It's meant to not throw an error.

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

{
  "browserslist": [
    ">= 0.2%",
    "not dead",
    "not ie <= 10",
    "not op_mini all",
    "ie 11",
    "chrome 41"
  ],

  "use strict";

const {minify} = require('terser');

module.exports = {
  presets: [
    ['@babel/env', {
      useBuiltIns: 'usage',
      loose:       true,
      modules:     'amd',
      corejs:      3
    }]
  ],
  plugins: [
    ['template-html-minifier', {
      modules: {
        'lit-html': ['html', 'svg'], // lit-html
        'lit-element': ['html', 'svg'], // LitElement
        '@polymer/polymer/polymer-element': ['html'], // Polymer 3 - exported from Polymer Element
        '@polymer/polymer/lib/utils/html-tag.js': ['html'], // Polymer 3 - exported from utils (used by PolymerElements family)
      },
      htmlMinifier: {
        caseSensitive:      true,
        collapseWhitespace: true,
        removeComments:     true,
        sortAttributes:     false,
        sortClassName:      false,
        minifyCSS:          true,
        minifyJS:           (code) => minify(code).code,
        useShortDoctype:    true
      },
    }],
    ['@babel/transform-runtime', {
      sourceType: 'unambiguous',
      corejs: 3
    }],
    ['@babel/proposal-decorators', {
      decoratorsBeforeExport: true,
    }],
    ['@babel/proposal-class-properties', {
      loose: false
    }],
    ['@babel/proposal-object-rest-spread'],
    ['@babel/syntax-dynamic-import']
  ]
};

"devDependencies": {
    "@babel/core": "7.4.4",
    "@babel/plugin-proposal-class-properties": "7.4.4",
    "@babel/plugin-proposal-decorators": "7.4.4",
    "@babel/plugin-proposal-object-rest-spread": "7.4.4",
    "@babel/plugin-syntax-dynamic-import": "7.2.0",
    "@babel/plugin-transform-runtime": "7.4.4",
    "@babel/preset-env": "7.4.4",
    "acorn": "6.1.1",
    "babel-eslint": "11.0.0-beta.0",
    "babel-loader": "8.0.6",
    "babel-loader-exclude-node-modules-except": "1.0.1",
    "babel-plugin-template-html-minifier": "3.0.0",

cli is just webpack + webpack dev server using the configs.
}

Environment

  • Babel version(s): 7 4 4
  • Node/npm version: 12.2
  • OS: win7
  • Monorepo: yes
  • How you are using Babel: loader

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