-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.js
42 lines (38 loc) · 1.26 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
import typescript from '@rollup/plugin-typescript'
import node from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import json from '@rollup/plugin-json'
// You can have more root bundles by extending this array
const rootFiles = ['index.ts']
export default rootFiles.map(name => {
/** @type { import("rollup").RollupOptions } */
const options = {
input: `src/${name}`,
external: ['typescript'],
output: {
name,
dir: 'dist',
format: 'amd',
},
plugins: [typescript({ tsconfig: 'tsconfig.json' }), commonjs(), node(), json()],
}
return options
})
/** Note:
* if you end up wanting to import a dependency which relies on typescript, you will need
* settings which adds these extra options. It will re-use the window.ts for the typescript
* dependency, and I've not figured a way to remove fs and path.
*
const options = {
external: ['typescript', 'fs', 'path'],
output: {
paths: {
"typescript":"typescript-sandbox/index",
"fs":"typescript-sandbox/index",
"path":"typescript-sandbox/index",
},
},
plugins: [typescript({ tsconfig: "tsconfig.json" }), externalGlobals({ typescript: "window.ts" }), commonjs(), node(), json()]
};
*
*/