-
-
Notifications
You must be signed in to change notification settings - Fork 171
/
vite.config.js
56 lines (54 loc) · 1.35 KB
/
vite.config.js
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
import { defineConfig } from 'vite'
import Vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
import Delete from 'rollup-plugin-delete'
// eslint-disable-next-line multiline-ternary
const build = process.env.BUNDLE ? {
lib: {
entry: resolve(__dirname, '/src/components/splitpanes/index.js'),
name: 'splitpanes',
fileName: 'splitpanes',
formats: ['es', 'umd', 'cjs']
},
rollupOptions: {
plugins: [
// Rollup also copies the files in the public folder.
// @todo: find a way to prevent adding them at all.
Delete({ targets: ['dist/*.{ico,png,html}'], hook: 'generateBundle' })
],
// Make sure to externalize deps that shouldn't be bundled into library.
external: ['vue'],
output: {
// Provide global variables to use in the UMD build for externalized deps.
globals: { vue: 'Vue' },
entryFileNames: 'splitpanes.[format].js',
chunkFileNames: '[name].js'
}
}
} : {
outDir: 'docs'
}
export default defineConfig({
plugins: [
Vue({
template: {
compilerOptions: {
whitespace: 'preserve'
}
}
})
], // https://vitejs.dev/config/
resolve: {
alias: {
'@': resolve(__dirname, '/src')
}
},
css: {
preprocessorOptions: {
scss: {
additionalData: '@import "@/scss/_variables.scss";'
}
}
},
build
})