forked from microsoft/typespec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.mjs
36 lines (35 loc) · 1.01 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
// @ts-check
import commonjs from "@rollup/plugin-commonjs";
import json from "@rollup/plugin-json";
import resolve from "@rollup/plugin-node-resolve";
import replace from "@rollup/plugin-replace";
import { defineConfig } from "rollup";
export default defineConfig({
input: "src/index.mjs",
output: {
file: "dist/index.js",
format: "commonjs",
sourcemap: true,
exports: "default",
},
inlineDynamicImports: true,
context: "this",
external: ["fs/promises", "prettier"],
treeshake: {
// Ignore those 2 modules are they aren't used in the code needed for the formatter.
// Otherwise rollup think they have side effect and to include a lot of unnecessary code in the bundle.
moduleSideEffects: ["ajv"],
},
plugins: [
resolve({ preferBuiltins: true }),
commonjs(),
json(),
replace({
values: {
"export const typespecVersion = getVersion();": `export const typespecVersion = "";`,
},
delimiters: ["", ""],
preventAssignment: true,
}),
],
});