-
Notifications
You must be signed in to change notification settings - Fork 5
/
rollup.config.js
35 lines (33 loc) · 1.18 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
import typescript from "@rollup/plugin-typescript";
const packageJson = require("./package.json");
export default {
input: "src/index.ts",
output: [
{
file: packageJson.main,
format: "cjs", // Output CommonJS to support node.js v12
sourcemap: true,
},
{
file: packageJson.module,
format: "esm", // Output ES Module to take advantage of newer tooling
sourcemap: true,
},
],
plugins: [
// Run source files through tsc prior to bundling.
// The typescript plugin inherits config from `tsconfig.json`.
// https://github.com/rollup/plugins/blob/master/packages/typescript/README.md
typescript({
// Compilation targeting node.js v12 and above as per:
// https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping#recommended-node-tsconfig-settings
// but using `module: "ES2015"` which is then bundled by Rollup: https://stackoverflow.com/a/66812779/3175260
target: "ES2015",
module: "ES2015",
outDir: "./dist",
exclude: ["__tests__/**/*.ts"],
}),
],
// Mark external dependencies to avoid 'Unresolved dependencies' warnings.
external: Object.keys(packageJson.dependencies),
};