mjeanroy/rollup-plugin-esformatter(新しいタブで開きます)
主要言語: JavaScript
Rollup plugin to beautify bundle with esformatter
- star 数
- 4
- watcher 数
- 1
- fork 数
- 0
- issue 数
- 6
- 最終更新
- 2026/10/31
主要言語: JavaScript
Rollup plugin to beautify bundle with esformatter
Rollup plugin that can be used to run esformatter on the final bundle.
Install the plugin with NPM:
npm install --save-dev rollup-plugin-esformatter
This plugin follow rollup versioning:
rollup-plugin-formatter@0.x.x with rollup@0.x.xrollup-plugin-formatter@1.x.x with rollup@1.x.xrollup-plugin-formatter@2.x.x with rollup@2.x.xThen add it to your rollup configuration:
const path = require('node:path'); const esformatter = require('rollup-plugin-esformatter');
module.exports = { input: path.join(__dirname, 'src', 'index.js'), output: { file: path.join(__dirname, 'dist', 'bundle.js'), }, plugins: [ // Run plugin with esformatter options. esformatter({ indent: { value: ' ', }, }), ], };
If source map is enabled in the global rollup options, then a source map will be generated on the formatted bundle (except if sourcemap are explicitely disabled in the esformatter plugin options).
Note that this may take some time since esformatter package is not able to generate a sourcemap and this plugin must compute the diff between the original bundle and the formatted result and generate the corresponding sourcemap: for this reason, sourcemap are disabled by default.
Here is an example:
const path = require('node:path'); const esformatter = require('rollup-plugin-esformatter'); module.exports = { input: path.join(__dirname, 'src', 'index.js'), output: { path.join(__dirname, 'dist', 'bundle.js'), sourcemap: true, }, plugins: [ // Run plugin with esformatter options. esformatter({ sourcemap: true, // Can also be disabled/enabled here. }), ], };
package.json to also support rollup 1.x.x.package.json file.sourceMap (camelcase) option.sourceMap option (camelcase), use sourcemap option instead (lowercase).sourcemap option (see rollup #1583).magic-string).MIT License (MIT)
If you find a bug or think about enhancement, feel free to contribute and submit an issue or a pull request.