-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.mjs
42 lines (41 loc) · 1.24 KB
/
rollup.config.mjs
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
/**
* \@rollup/plugin-typescript had issue with "export type":
* [!] RollupError: Unexpected token (Note that you need plugins to import files that are not JavaScript)
* Switched over to a fork rollup-plugin-typescript2 resolved the issue.
*/
import typescript from "rollup-plugin-typescript2";
import { defineConfig } from "rollup";
export default defineConfig({
input: "src/index.ts",
output: [
{
dir: "./dist/esm",
/**
* use mjs extension so NodeJS will recognize the bundle as ES modules
* https://nodejs.org/api/packages.html#determining-module-system
*/
entryFileNames: "[name].mjs",
format: "esm",
/** preserve original module files instead of compressing all to one file */
preserveModules: true,
sourcemap: true,
/**
* set to "auto" to follow TypeScript's esModuleInterop behavior to ensures compatibility
* of default, namespace, and dynamic imports from external deps (e.g. react-textarea-autosize).
*/
interop: "auto",
},
{
dir: "./dist/commonjs",
format: "cjs",
preserveModules: true,
sourcemap: true,
interop: "auto",
},
],
plugins: [
typescript({
tsconfig: "./tsconfig.json",
}),
],
});