babel-plugin-transform-custom-element-classes | Compile ES6 HTMLElement class extensions to ES5 | Script Programming library
kandi X-RAY | babel-plugin-transform-custom-element-classes Summary
kandi X-RAY | babel-plugin-transform-custom-element-classes Summary
Compile ES6 HTMLElement class extensions to ES5
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of babel-plugin-transform-custom-element-classes
babel-plugin-transform-custom-element-classes Key Features
babel-plugin-transform-custom-element-classes Examples and Code Snippets
Community Discussions
Trending Discussions on babel-plugin-transform-custom-element-classes
QUESTION
I'd like to extend MediaSource. I'm using Babel.
...ANSWER
Answered 2017-Sep-16 at 00:00Generally extending builtin types does not work with compiled classes from Babel, so you'd need to configure Babel to not process classes, and limit your application to only browsers that support classes.
Assuming your target browsers all support ES6 class syntax, the easiest approach would be to use babel-preset-env
configured for those target environments.
You can also try to use transform-builtin-extend
in your Babel config for MediaSource
, though that does tend to vary with exactly which things can be extended.
QUESTION
I converting a Polymer app to Polymer 2. I'm changing my components to the ES6 Class syntax (yes I know I could leave them in v1.7 hybrid style but I would like them to be ES6 Classes).
However when I transpile the code back to ES5 (with BabelJS) I run into a known issue regarding ES5 'classes' extending native elements (https://github.com/babel/babel/issues/4480).
I tried babel-plugin-transform-custom-element-classes but that didn't work. So I tried the webcomponents shim meant to fix this issue: https://github.com/webcomponents/webcomponentsjs#custom-elements-es5-adapterjs
But the shim doesn't work! I don't know what I'm doing wrong :(
...ANSWER
Answered 2017-Apr-08 at 15:01Well, I was doing something silly.. I should have tried upgrading my Babel package.
Upgraded BabelJS from 6.23.1 to latest 6.24.1 and it fixed the problem. :P
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install babel-plugin-transform-custom-element-classes
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page