https://github.com/jsweb/rollup-plugin-esmin
Rollup plugin to minify ES6+ code using babel-minify with no transpiling to ES5
https://github.com/jsweb/rollup-plugin-esmin
Last synced: 12 months ago
JSON representation
Rollup plugin to minify ES6+ code using babel-minify with no transpiling to ES5
- Host: GitHub
- URL: https://github.com/jsweb/rollup-plugin-esmin
- Owner: jsweb
- License: mit
- Created: 2018-10-04T15:03:01.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T01:35:58.000Z (over 3 years ago)
- Last Synced: 2024-08-08T23:15:21.438Z (almost 2 years ago)
- Language: JavaScript
- Homepage:
- Size: 225 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rollup-plugin-esmin
Rollup plugin to minify ES6+ code using babel-minify with no transpiling to ES5.
## Why?
Modern browsers and Node.js are up to date with ES6+ native support.
Except for the **work in progress** `import` and `export` native support, but it is coming soon.
So, we can generate lighter bundles now by just let **rollup** resolve `import` and `export` and not transpiling ES6+ code to ES5, but just minifying it.
## Install
```
npm i -D rollup-plugin-esmin
```
or
```
yarn add -D rollup-plugin-esmin
```
## Usage
Just import on rollup config script and call it into `plugins` array.
```javascript
import esmin from 'rollup-plugin-esmin'
export default {
input: 'src/escode.js',
plugins: [
esmin()
],
output: {
format: 'umd',
file: 'dist/modern.umd.js'
}
}
```
Optionally, `esmin()` can receive an object argument with parameters to transmit to `babel-minify`.
This object can contains these optional keys:
```javascript
esmin({
options: {},
overrides: {}
})
```
Those `options` and `overrides` are the same as documented at [babel-minify](https://github.com/babel/minify/tree/master/packages/babel-minify).
### Important
If you are using any other plugins to transform your code (like Typescript), it must be executed **before**.
`rollup-plugin-esmin` just minify ES6+ code.