WebReflection / babel-plugin-transform-builtin-classes

A fix for the infamous Babel #4480 bug.
https://github.com/babel/babel/issues/4480
ISC License
43 stars 2 forks source link

Using babel-cli #4

Closed oravecz closed 7 years ago

oravecz commented 7 years ago

My HTMLElement subclasses are not being wrapped with your helper function, so I tore my project down to the basics. One thing I do not understand is why the plugin doesn't seem to work from the command line.

For example, if I run the following from the root of this project, I do not generate a wrapped HTMLElement.

babel test/cool-element.js 
WebReflection commented 7 years ago

My HTMLElement subclasses are not being wrapped with your helper function

IIRC as long as the HTMLElement one is it should be fine ... or you should specify your classes in the list of classes that needs wrapping.

No idea about the CLI, it probably doesn't use the right .babelrc ?

oravecz commented 7 years ago

It should be using the .babelrc (the one in the root of your project) by default. There is a flag to tell it to not use the .babelrc.

Is that extra level of array [...] in your .babelrc plugins property intended?

WebReflection commented 7 years ago

look here: https://github.com/WebReflection/babel-plugin-transform-builtin-classes#usage

You need to specify which builtin class you are willing to extend because it's basically impossible to know that at runtime.

HyperHTMLElement class uses this and it just works.

You can even extend N levels the HyperHTMLElement class and nothing happens.

So my next question would be: are you using a polyfill for Custom Elements ?

Is such polyfill a reliable one, like dre is?

WebReflection commented 7 years ago

It looks like you are opining other issues but you are not answering this one.

I am closing this in few minutes if there's nothing to do.

Thanks for any sort of clarification.

oravecz commented 7 years ago

This issue was wondering why babel-cli run from the root of your project doesn't decorate your test class. I thought the crux of my problem might be caused because I was using the same .babelrc file from your project.