-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
35 lines (34 loc) · 983 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
import replace from "@rollup/plugin-replace"
import terser from "@rollup/plugin-terser"
import typescript from "@rollup/plugin-typescript"
import {defineConfig} from "rollup"
import dts from "rollup-plugin-dts"
export default defineConfig([
{
plugins: [
replace({"import.meta.vitest": "undefined", preventAssignment: true}),
typescript({
compilerOptions: {allowSyntheticDefaultImports: true},
sourceMap: true,
}),
terser(),
],
external(id) {
const prefixes = ["markdown-it"]
for (const prefix of prefixes) {
if (id.startsWith(prefix)) return true
}
return false
},
input: "index.ts",
output: [
{file: "index.js", format: "esm", sourcemap: true},
{file: "index.cjs", format: "cjs", sourcemap: true},
],
},
{
plugins: [dts({compilerOptions: {allowSyntheticDefaultImports: true}})],
input: "index.ts",
output: {file: "index.d.ts", format: "esm"},
},
])