-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.config.js
executable file
·77 lines (75 loc) · 1.85 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
74
75
76
77
import pkg from './package.json'
import resolve from '@rollup/plugin-node-resolve'
import typescript from 'rollup-plugin-typescript2'
import vue from 'rollup-plugin-vue'
import css from 'rollup-plugin-css-porter'
import less from 'rollup-plugin-less'
import filesize from 'rollup-plugin-filesize'
// Default configs
const name = 'VueEmojiBox'
const exports = 'named'
const sourcemap = false
const globals = {
'vue-property-decorator': 'vuePropertyDecorator'
}
export default {
input: 'src/index.ts', // our source file
inlineDynamicImports: true,
output: [
{
// Keep the bundle as an ES module file, suitable for other bundlers
// and inclusion as a <script type=module> tag in modern browsers
name,
file: pkg.module,
format: 'esm', // the preferred format
compact: true,
exports,
sourcemap
},
{
// A self-executing function, suitable for inclusion as a <script> tag.
// (If you want to create a bundle for your application, you probably want to use this.)
name,
file: pkg.unpkg,
format: 'iife',
compact: true,
exports,
sourcemap,
globals
},
{
// CommonJS, suitable for Node and other bundlers
name,
file: pkg.main,
format: 'cjs',
compact: true,
exports,
sourcemap,
globals
}
],
external: [...Object.keys(pkg.dependencies)],
plugins: [
typescript({
typescript: require('typescript'),
module: 'esnext',
tsconfig: 'tsconfig.json',
rollupCommonJSResolveHack: true,
tsconfigOverride: { exclude: ['node_modules', 'src/main.ts', 'src/assets'] }
}),
less(),
css(),
vue({
css: true,
template: {
isProduction: true
}
}),
resolve({
extensions: ['.js', '.ts']
}),
filesize({
showBrotliSize: true
})
]
}