- Commonjs
-
typescript
安装相关依赖
yarn add typescript tslib
yarn add @rollup/plugin-typescript -D
使用插件 ```javascript import ts from “@rollup/plugin-typescript”;
const plugins = [ ts(), ];
- Replace
- Node resolve
<a name="B284V"></a>
# eslint
- 安装相关依赖
```javascript
yarn add @rollup/plugin-eslint eslint -D
yarn add eslint-config-standard eslint-plugin-import eslint-plugin-promise eslint-plugin-node -D
修改配置
import eslint from "@rollup/plugin-eslint"; const plugins = [ eslint({ throwOnError: true, // 如果语法不合格,打包直接报错 }), ];
image
安装相关依赖
yarn add @rollup/plugin-image -D
修改配置
import image from "@rollup/plugin-image"; const plugins = [ image(), ];
添加代码
import img from "./logo.png"; console.log(img);
strip
安装相关依赖
yarn add @rollup/plugin-strip -D
修改配置
import strip from "@rollup/plugin-strip"; const plugins = [ strip(), ];
wasm