-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
43 lines (39 loc) · 1.16 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
import commonjs from "@rollup/plugin-commonjs";
import { nodeResolve } from "@rollup/plugin-node-resolve";
import typescript from "@rollup/plugin-typescript";
import del from 'rollup-plugin-delete'
import { dts } from "rollup-plugin-dts";
import { readFileSync } from 'fs';
const PACKAGE_NAME = "three-js-blobtree"
const PACKAGE_JSON = JSON.parse(readFileSync('package.json', 'utf8'))
const external = [
...Object.keys(PACKAGE_JSON.dependencies ?? {}),
...Object.keys(PACKAGE_JSON.peerDependencies ?? {})
]
export default [
// bundle code
{
input: { 'module': "./src/exports.ts" },
plugins: [
del({ targets: 'dist/*' }),
typescript(),
commonjs(),
nodeResolve(),
],
external: external,
output: [
{
dir: `./dist`,
entryFileNames: `${PACKAGE_NAME}.[name].js`,
format: "esm",
sourcemap: true,
},
],
},
// bundle types
{
input: "./dist/types/exports.d.ts",
output: [{ file: `dist/${PACKAGE_NAME}.module.d.ts`, format: "es" }],
plugins: [dts()],
}
]