-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
36 lines (34 loc) · 884 Bytes
/
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
const del = require('rollup-plugin-delete');
const commonjs = require('@rollup/plugin-commonjs');
const typescript = require('@rollup/plugin-typescript')
const { nodeResolve } = require('@rollup/plugin-node-resolve');
const entries = [
'./src/index.ts'
]
module.exports = [
{
input: entries,
output: [
{
dir: 'dist',
entryFileNames: '[name].mjs',
chunkFileNames: '[name]-[hash].mjs',
format: 'esm',
},
{
dir: 'dist',
entryFileNames: '[name].js',
chunkFileNames: '[name]-[hash].js',
format: 'cjs',
},
],
external: id =>
!id.startsWith('\0') && !id.startsWith('.') && !id.startsWith('/'),
plugins: [
del({ targets: 'dist/*' }),
nodeResolve({ extensions: ['.js', '.ts'] }),
commonjs(),
typescript({ tsconfig: "./tsconfig.json" })
],
},
]