-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.build.config.mts
99 lines (96 loc) · 1.99 KB
/
vite.build.config.mts
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import { defineConfig } from 'vite';
import * as path from 'path';
import AutoImport from 'unplugin-auto-import/vite';
import commonjs from '@rollup/plugin-commonjs';
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js';
import dts from 'vite-plugin-dts';
import pkg from './package.json';
import terser from '@rollup/plugin-terser';
import typescript from 'rollup-plugin-typescript2';
import vue from '@vitejs/plugin-vue';
import vuetify, { transformAssetUrls } from 'vite-plugin-vuetify';
import { viteStaticCopy } from 'vite-plugin-static-copy';
const banner = `/**
* @name ${pkg.name}
* @version ${pkg.version}
* @description ${pkg.description}
* @author ${pkg.author}
* @copyright Copyright ${new Date().getFullYear()}, __USERNAME__
* @homepage ${pkg.homepage}
* @repository ${pkg.repository}
* @license ${pkg.license} License
*/
`;
export default defineConfig({
publicDir: false,
build: {
lib: {
entry: './src/plugin/index.ts',
name: pkg.name,
formats: ['es', 'cjs'],
fileName: format => `${pkg.name}.${format}.js`,
},
rollupOptions: {
input: {
main: path.resolve(__dirname, './src/plugin/index.ts')
},
external: [
...Object.keys(pkg.dependencies || {}),
],
output: {
banner,
},
},
},
plugins: [
commonjs(),
AutoImport({
dts: false,
imports: [
'vue',
{
vue: ['CSSProperties'],
}
],
vueTemplate: true,
}),
vue({
template: { transformAssetUrls },
}),
dts({
insertTypesEntry: true,
}),
typescript({
check: true,
include: ['./src/plugin/**/*.vue'],
}),
vuetify({
autoImport: true,
}),
cssInjectedByJsPlugin({ topExecutionPriority: false }),
viteStaticCopy({
targets: [
{
src: 'src/plugin/styles/*',
dest: 'scss',
},
]
}),
terser(),
],
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
'@root': path.resolve(__dirname, './')
},
extensions: [
'.js',
'.json',
'.jsx',
'.mjs',
'.ts',
'.tsx',
'.vue',
],
},
});