diff options
author | 2020-11-18 23:26:45 +0100 | |
---|---|---|
committer | 2020-11-18 23:26:45 +0100 | |
commit | 81ddf9b700bc48a1f8e472209f080f9c1d9a9b09 (patch) | |
tree | 8b959d50c5a614cbf9fcb346ed556140374d4b6d /node_modules/babel-plugin-transform-es2015-classes/README.md | |
parent | 1870f3fdf43707a15fda0f609a021f516f45eb63 (diff) | |
download | website_creator-81ddf9b700bc48a1f8e472209f080f9c1d9a9b09.tar.gz website_creator-81ddf9b700bc48a1f8e472209f080f9c1d9a9b09.tar.bz2 website_creator-81ddf9b700bc48a1f8e472209f080f9c1d9a9b09.zip |
rm node_modules
Diffstat (limited to 'node_modules/babel-plugin-transform-es2015-classes/README.md')
-rw-r--r-- | node_modules/babel-plugin-transform-es2015-classes/README.md | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/node_modules/babel-plugin-transform-es2015-classes/README.md b/node_modules/babel-plugin-transform-es2015-classes/README.md deleted file mode 100644 index c189adf..0000000 --- a/node_modules/babel-plugin-transform-es2015-classes/README.md +++ /dev/null @@ -1,85 +0,0 @@ -# babel-plugin-transform-es2015-classes - -> Compile ES2015 classes to ES5 - -## Caveats - -Built-in classes such as `Date`, `Array`, `DOM` etc cannot be properly subclassed -due to limitations in ES5 (for the [es2015-classes](http://babeljs.io/docs/plugins/transform-es2015-classes) plugin). -You can try to use [babel-plugin-transform-builtin-extend](https://github.com/loganfsmyth/babel-plugin-transform-builtin-extend) based on `Object.setPrototypeOf` and `Reflect.construct`, but it also has some limitations. - -## Installation - -```sh -npm install --save-dev babel-plugin-transform-es2015-classes -``` - -## Usage - -### Via `.babelrc` (Recommended) - -**.babelrc** - -```js -// without options -{ - "plugins": ["transform-es2015-classes"] -} - -// with options -{ - "plugins": [ - ["transform-es2015-classes", { - "loose": true - }] - ] -} -``` - -### Via CLI - -```sh -babel --plugins transform-es2015-classes script.js -``` - -### Via Node API - -```javascript -require("babel-core").transform("code", { - plugins: ["transform-es2015-classes"] -}); -``` - -## Options - -### `loose` - -`boolean`, defaults to `false`. - -#### Method enumerability - -Please note that in loose mode class methods **are** enumerable. This is not in line -with the spec and you may run into issues. - -#### Method assignment - -Under loose mode, methods are defined on the class prototype with simple assignments -instead of being defined. This can result in the following not working: - -```javascript -class Foo { - set bar() { - throw new Error("foo!"); - } -} - -class Bar extends Foo { - bar() { - // will throw an error when this method is defined - } -} -``` - -When `Bar.prototype.foo` is defined it triggers the setter on `Foo`. This is a -case that is very unlikely to appear in production code however it's something -to keep in mind. |