Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A plugin for Babel 6 supports extending from builtin types based on static analysis.

License

NotificationsYou must be signed in to change notification settings

loganfsmyth/babel-plugin-transform-builtin-extend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a Babel 6 plugin to enable extending builtin types like "Error" and "Array" and such,which require special treatment and require static analysis to detect.

Usage

In your Babel 6 configuration, for example in a.babelrc you might have

{    "plugins": [        ["babel-plugin-transform-builtin-extend", {            globals: ["Error", "Array"]        }]    ]}

which would enable the plugin and configure it to look for any class extendingError orArray globals.

IE<=10

On older browsers that do not support reassigning the prototype of an existing object, you will need toenable theapproximate mode, which will fall back to the Babel 5 behavior of using simple ES5 inheritanceto approximate extending a class, though your results may vary depending on your goals.

{    "plugins": [        ["babel-plugin-transform-builtin-extend", {            globals: ["Error", "Array"],            approximate: true        }]    ]}

Limitations

This plugin will only reles on assigning__proto__ for static property inheritance from parent constructors.If you are relying on this, it will not work on IE<=10 and any other browsers that don't support__proto__.

About

A plugin for Babel 6 supports extending from builtin types based on static analysis.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp