-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
vite.config.js
55 lines (53 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
import { defineConfig } from 'vite'
import Vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
import Delete from 'rollup-plugin-delete'
import autoprefixer from 'autoprefixer'
// eslint-disable-next-line multiline-ternary
const bundleBuild = {
lib: {
entry: resolve(__dirname, '/src/components/simple-syntax-highlighter.vue'),
name: 'sshpre',
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'], 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: 'sshpre.[format].js',
chunkFileNames: '[name].js'
}
}
}
export default defineConfig({
plugins: [
Vue({
template: {
compilerOptions: {
whitespace: 'preserve'
}
}
})
],
css: {
postcss: {
plugins: [autoprefixer]
}
},
resolve: {
alias: {
'@': resolve(__dirname, '/src')
}
},
build: process.env.BUNDLE ? bundleBuild : { outDir: 'docs' },
define: {
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: false
}
})