-
-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathvite.config.js
63 lines (61 loc) · 1.53 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
57
58
59
60
61
62
63
import { defineConfig } from 'vite'
import Vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
import Delete from 'rollup-plugin-delete'
import autoprefixer from 'autoprefixer'
const bundlingConf = {
minify: true,
lib: {
entry: resolve(__dirname, '/src/components/vueperslides/index.js'),
name: 'vueperslides',
fileName: format => `vueperslides.${format}.js` // Output filename pattern
},
rollupOptions: {
plugins: [
// Rollup also copies the files in the public folder.
// @todo: find a way to prevent adding them at all.
Delete({ targets: ['dist/images', 'dist/*.{ico,png}'], hook: 'generateBundle' })
],
// Make sure to externalize deps that shouldn't be bundled into library.
external: ['vue'],
output: {
globals: {
vue: 'Vue' // Vue should be treated as external and available as a global variable
}
}
}
}
export default defineConfig({
define: {
'process.env': {
...process.env,
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: false
}
},
plugins: [
Vue({
template: {
compilerOptions: {
whitespace: 'preserve'
}
}
})
], // https://vitejs.dev/config/
resolve: {
alias: {
'@': resolve(__dirname, '/src')
}
},
css: {
preprocessorOptions: {
scss: {
api: 'modern-compiler',
additionalData: '@use "@/scss/variables" as *;'
}
},
postcss: {
plugins: [autoprefixer]
}
},
build: process.env.BUNDLE ? bundlingConf : { outDir: 'docs' }
})