- CLI
-
JS API
- –format
- iife
- cjs
- umd
- ES6 import
- only implemented in modern browser
- not finalised in
Node.js
1
2
// commonJS
const utils = require('./utils');
1
2
// ES6
import { ajax } from './utils';
config file
rollup.config.js
:
1
2
3
4
5
6
7
export default {
input: 'src/main.js',
output: {
file: 'bundle.js',
format: 'cjs'
}
};
with TypeScript
:
install Plugin @rollup/plugin-typescript
1
rollup --config rollup.config.ts --configPlugin typescript