transform-fs-promises-webpack-plugin
Version:
A webpack plugin to transform fs promises APIs for compatible with lower Node.js versions.
44 lines (29 loc) • 1.38 kB
Markdown
# transform-fs-promises-webpack-plugin
[](https://996.icu/#/en_US)
[](https://github.com/996icu/996.ICU/blob/master/LICENSE)

[](https://badge.fury.io/js/transform-fs-promises-webpack-plugin)
A Webpack plugin to transform `require('fs/promises')` to `require('fs').promises` for compatible with Node.js 14 and below.
Compatible with `webpack@5` and `webpack@4`.
## Installation
```bash
npm install transform-fs-promises-webpack-plugin --save
```
## Usage
```js
// import via esm
import { TransformFsPromisesPlugin } from "transform-fs-promises-webpack-plugin";
// import via cjs
const { TransformFsPromisesPlugin } = require("transform-fs-promises-webpack-plugin");
```
```js
const { TransformFsPromisesPlugin } = require("transform-fs-promises-webpack-plugin");
/** @type {import('webpack').Configuration} */
module.exports = {
plugins: [new TransformFsPromisesPlugin()],
};
```
## Relative
- [babel-plugin-transform-fs-promises](https://github.com/axetroy/babel-plugin-transform-fs-promises)
## License
The [Anti 996 License](LICENSE)