[skip ci] removed shorthand usage of official babel scoped presets & plugins from README.md's (#6820)
This commit is contained in:
committed by
Henry Zhu
parent
39dae28d5c
commit
cee9ae48e0
@@ -35,13 +35,13 @@ npm install --save-dev @babel/plugin-transform-modules-commonjs
|
||||
```js
|
||||
// without options
|
||||
{
|
||||
"plugins": ["@babel/transform-modules-commonjs"]
|
||||
"plugins": ["@babel/plugin-transform-modules-commonjs"]
|
||||
}
|
||||
|
||||
// with options
|
||||
{
|
||||
"plugins": [
|
||||
["@babel/transform-modules-commonjs", {
|
||||
["@babel/plugin-transform-modules-commonjs", {
|
||||
"allowTopLevelThis": true
|
||||
}]
|
||||
]
|
||||
@@ -51,14 +51,14 @@ npm install --save-dev @babel/plugin-transform-modules-commonjs
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins @babel/transform-modules-commonjs script.js
|
||||
babel --plugins @babel/plugin-transform-modules-commonjs script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["@babel/transform-modules-commonjs"]
|
||||
plugins: ["@babel/plugin-transform-modules-commonjs"]
|
||||
});
|
||||
```
|
||||
|
||||
@@ -82,7 +82,7 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
```
|
||||
|
||||
In environments that don't support this you can enable loose mode on `babel-plugin-transform-modules-commonjs`
|
||||
In environments that don't support this you can enable loose mode on `@babel/plugin-transform-modules-commonjs`
|
||||
and instead of using `Object.defineProperty` an assignment will be used instead.
|
||||
|
||||
```javascript
|
||||
|
||||
Reference in New Issue
Block a user