-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathrollup.js
48 lines (46 loc) · 1.29 KB
/
rollup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const
rollup = require('rollup'),
babel = require('rollup-plugin-babel'),
json = require('rollup-plugin-json'),
nodeResolve = require('rollup-plugin-node-resolve'),
commonjs = require('rollup-plugin-commonjs'),
riot = require('rollup-plugin-riot'),
changeCase = require('change-case'),
packageName = require('./package.json').name
rollup
.rollup({
entry: 'src/index.js',
external: ['riot'],
plugins: [riot(), json(), nodeResolve({ jsnext: true }), babel()]
})
.then(bundle => {
bundle.write({
format: 'iife',
moduleName: changeCase.camelCase(packageName),
globals: { riot: 'riot' },
dest: `dist/${ packageName }.js`
})
bundle.write({ format: 'es', dest: `dist/${ packageName }.es6.js` })
bundle.write({ format: 'amd', dest: `dist/${ packageName }.amd.js` })
bundle.write({ format: 'cjs', dest: `dist/${ packageName }.cjs.js` })
})
.catch(error => {
console.error(error)
})
rollup
.rollup({
entry: 'demo/index.js',
external: ['riot'],
plugins: [riot(), nodeResolve({ jsnext: true }), commonjs(), babel()]
})
.then(bundle => {
bundle.write({
format: 'iife',
moduleName: 'app',
globals: { riot: 'riot' },
dest: `dist/demo.js`
})
})
.catch(error => {
console.error(error)
})