Refactor move docs (#8108)
* feat: [skip] generate readme script * docs: [skip ci] update READMEs * docs: [skip ci] fix code block type * chore: [skip ci] move generator script
This commit is contained in:
@@ -1,61 +1,19 @@
|
||||
# @babel/plugin-transform-modules-amd
|
||||
|
||||
> This plugin transforms ES2015 modules to [Asynchronous Module Definition (AMD)](https://github.com/amdjs/amdjs-api).
|
||||
> This plugin transforms ES2015 modules to AMD
|
||||
|
||||
## Example
|
||||
See our website [@babel/plugin-transform-modules-amd](https://new.babeljs.io/docs/en/next/babel-plugin-transform-modules-amd.html) for more information.
|
||||
|
||||
**In**
|
||||
## Install
|
||||
|
||||
```javascript
|
||||
export default 42;
|
||||
```
|
||||
|
||||
**Out**
|
||||
|
||||
```javascript
|
||||
define(["exports"], function (exports) {
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.default = 42;
|
||||
});
|
||||
```
|
||||
|
||||
## Installation
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/plugin-transform-modules-amd
|
||||
npm install --save @babel/plugin-transform-modules-amd
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Via `.babelrc` (Recommended)
|
||||
|
||||
**.babelrc**
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["@babel/plugin-transform-modules-amd"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
babel --plugins @babel/plugin-transform-modules-amd script.js
|
||||
yarn add --save @babel/plugin-transform-modules-amd
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["@babel/plugin-transform-modules-amd"]
|
||||
});
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
See options for `@babel/plugin-transform-modules-commonjs`.
|
||||
|
||||
Reference in New Issue
Block a user