-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrollup.config.js
73 lines (68 loc) · 1.63 KB
/
rollup.config.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import path from 'path'
import resolve from 'rollup-plugin-node-resolve'
import commonjs from 'rollup-plugin-commonjs'
import buble from 'rollup-plugin-buble'
import license from 'rollup-plugin-license'
import filesize from 'rollup-plugin-filesize'
import standard from 'rollup-plugin-standard'
// import builtins from 'builtin-modules'
import builtins from 'rollup-plugin-node-builtins'
const packageJSON = require('./package.json')
const config = {
name: packageJSON.name
}
const bundleName = config.name
const defaultConfig = [{
input: 'src/index.js',
external: ['fs', 'stream', 'path', 'assert', 'util', 'os'],
plugins: [
standard(),
// builtins(),
commonjs({
include: 'node_modules/**'
}),
resolve({
include: 'node_modules/**',
extensions: ['.js'],
preferBuiltins: true
}),
buble({
objectAssign: 'Object.assign'
}),
license({
sourceMap: true,
cwd: '.', // Default is process.cwd()
banner: {
file: path.join(__dirname, 'build.inputs/LICENSE.txt'),
encoding: 'utf-8', // Default is utf-8
// Optional, may be an object or a function returning an object.
data () {
return config
}
}
}),
filesize()
],
output: [
{
sourcemap: true,
file: `./dist/${bundleName}.js`,
format: 'cjs',
exports: 'named'
},
{
sourcemap: true,
file: `./dist/${bundleName}.es.js`,
format: 'esm',
exports: 'named'
}
],
watch: {
chokidar: true
// clearScreen: true,
// include: 'src/**'
}
}]
export default commandLineArgs => {
return defaultConfig
}