-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathrollup.config.js
43 lines (40 loc) · 992 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
37
38
39
40
41
42
43
import pkg from "./package.json";
import babel from "@rollup/plugin-babel";
import resolve from "@rollup/plugin-node-resolve";
const deps = { ...pkg.dependencies, ...pkg.peerDependencies };
// bundle web workers
import webWorkerLoader from "rollup-plugin-web-worker-loader";
import commonjs from "@rollup/plugin-commonjs";
//https://2ality.com/2017/02/babel-preset-env.html
const extensions = [".js", ".ts"];
export default {
input: "src/index.ts", // our source file
output: [
{
file: pkg.main,
format: "cjs",
sourcemap: true,
exports: "named",
},
{
file: pkg.module,
format: "esm",
sourcemap: true,
},
],
external: Object.keys(deps),
plugins: [
resolve({ extensions, module: true }),
commonjs(),
babel({
extensions,
exclude: "node_modules/**",
}),
webWorkerLoader({
inline: true,
targetPlatform: "browser",
extensions: ["ts", "js"],
external: [],
}),
],
};