forked from azat-io/eslint-plugin-perfectionist
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
59 lines (58 loc) · 1.67 KB
/
vite.config.ts
File metadata and controls
59 lines (58 loc) · 1.67 KB
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
53
54
55
56
57
58
59
import { prettierFormat } from 'vite-plugin-prettier-format'
import { defineConfig } from 'vite'
import dts from 'vite-plugin-dts'
import path from 'node:path'
export default defineConfig({
plugins: [
dts({
beforeWriteFile: (filePath, content) => ({
content: content.replaceAll(
/(?<importPath>(?:from|import\s*\()\s*["']\..*?)(?<quote>["'])/gu,
(...replaceArguments) => {
let { importPath, quote } = replaceArguments.at(-1) as {
importPath: string
quote: string
}
if (importPath.endsWith('.js') || importPath.endsWith('.json')) {
return `${importPath}${quote}`
}
return `${importPath}.js${quote}`
},
),
filePath,
}),
include: [
path.join(import.meta.dirname, 'index.ts'),
path.join(import.meta.dirname, 'types'),
path.join(import.meta.dirname, 'rules'),
path.join(import.meta.dirname, 'utils'),
],
insertTypesEntry: true,
copyDtsFiles: true,
strictOutput: true,
}),
prettierFormat(),
],
build: {
lib: {
entry: [
path.resolve(import.meta.dirname, 'index.ts'),
path.resolve(import.meta.dirname, 'utils', 'alphabet.ts'),
],
fileName: (_format, entryName) => `${entryName}.js`,
name: 'eslint-plugin-perfectionist',
formats: ['es'],
},
rolldownOptions: {
output: {
preserveModules: true,
exports: 'auto',
},
external: (id: string) => !id.startsWith('.') && !path.isAbsolute(id),
experimental: {
attachDebugInfo: 'none',
},
},
minify: false,
},
})