Coder Social home page Coder Social logo

Comments (5)

trusktr avatar trusktr commented on May 24, 2024

I manually installed @babel/plugin-transform-classes, so babelrc is like

{
    "plugins": [
        "transform-classes",
        ["transform-builtin-classes", {
            "globals": ["HTMLElement"]
        }]
    ]
}

but no luck:

Failed to construct 'HTMLElement': Please use the 'new' operator, this DOM object constructor cannot be called as a function.

from babel-plugin-transform-builtin-classes.

trusktr avatar trusktr commented on May 24, 2024

If you'd like to try seeing why it won't work in Meteor, it's really easy: just make a new Meteor project with the CLI,

meteor create foo
cd foo
# add above to .babelrc
npm i
npm i babel-plugin-transform-builtin-classes --save-dev
# write a custom elements and try to use it in the DOM, f.e. in main.js
meteor

and you'll get the error.

from babel-plugin-transform-builtin-classes.

trusktr avatar trusktr commented on May 24, 2024

Not sure where to start debugging this. I'd really like to get Custom Elements v1 working inside a Meteor app (i.e. using Meteor's build setup rather than transpiling them separately from the outside).

from babel-plugin-transform-builtin-classes.

WebReflection avatar WebReflection commented on May 24, 2024

babel 7 has my transformer included in core

my transformer works like this

{
  "plugins": [
    // either the preset es2015 or at least the following
    "babel-plugin-transform-es2015-classes",
    ["babel-plugin-transform-builtin-classes", {
      "globals": ["HTMLElement"]
    }]
  ]
}

I don't know about the plugin "transform-classes" but I'm pretty sure it's not compatible with this transformer which works only with the Babel one.

If their "transform-classes" is special, I suggest you invert the transformation order.

I don't know otherwise how to help and since this made it into core I'm not really wasting too much time on this. PR welcome if you find a solution.

from babel-plugin-transform-builtin-classes.

trusktr avatar trusktr commented on May 24, 2024

Yep, just saw babel/babel#7020! :)

from babel-plugin-transform-builtin-classes.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.