-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
52 lines (50 loc) · 1.33 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
43
44
45
46
47
48
49
50
51
52
import { prettierFormat } from 'vite-plugin-prettier-format'
import { defineConfig } from 'vite'
import dts from 'vite-plugin-dts'
import fs from 'node:fs/promises'
import path from 'node:path'
export default defineConfig({
build: {
rollupOptions: {
onwarn: (warning, warn) => {
let suppressedCodes = ['MIXED_EXPORTS']
if (!suppressedCodes.includes(warning.code ?? '')) {
warn(warning)
}
},
output: {
preserveModules: true,
exports: 'auto',
},
external: (id: string) => !id.startsWith('.') && !path.isAbsolute(id),
},
lib: {
fileName: (_format, entryName) => `${entryName}.js`,
entry: [path.resolve(__dirname, 'index.ts')],
name: 'eslint-plugin-de-morgan',
formats: ['cjs'],
},
minify: false,
},
plugins: [
dts({
afterBuild: async () => {
await fs.writeFile(
'dist/index.d.ts',
`${(await fs.readFile('dist/index.d.ts'))
.toString()
.replace(/\nexport .+/u, '')}export = _default`,
)
},
include: [
path.join(__dirname, 'index.ts'),
path.join(__dirname, 'rules'),
path.join(__dirname, 'utils'),
],
insertTypesEntry: true,
strictOutput: true,
rollupTypes: true,
}),
prettierFormat(),
],
})