-
Notifications
You must be signed in to change notification settings - Fork 2
/
vite.config.ts
42 lines (41 loc) · 1.14 KB
/
vite.config.ts
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
/// <reference types="vitest" />
import { defineConfig } from 'vite';
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js';
import dtsPlugin from 'vite-plugin-dts';
import { appendFile, readFile } from "fs/promises";
export default defineConfig({
plugins: [
cssInjectedByJsPlugin(),
dtsPlugin({
clearPureImport: false,
rollupTypes: true,
async afterBuild() {
// Due to https://github.com/microsoft/rushstack/issues/1709, our module augmentations are lost during
// the type rollup. As an ugly workaround, we simply append them here.
const filterFile = await readFile("./src/injections-types.mts");
await appendFile("./dist/L.DraggableLines.d.ts", filterFile);
},
})
],
build: {
sourcemap: true,
minify: false,
lib: {
entry: `./src/index.ts`,
name: 'L.DraggableLines',
fileName: () => "L.DraggableLines.js",
formats: ["es"]
},
rollupOptions: {
external: (id) => !id.startsWith("./") && !id.startsWith("../") && /* resolved internal modules */ !id.startsWith("/")
}
},
resolve: {
alias: {
'leaflet-draggable-lines': './src/index.ts'
}
},
test: {
environment: 'happy-dom'
}
});