-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.js
63 lines (59 loc) · 1.49 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 { resolve } from 'path'
import vue from '@vitejs/plugin-vue'
import autoprefixer from 'autoprefixer'
import pkg from './package.json'
const banner = `/*!
* ${pkg.name} v${pkg.version}
* (c) ${new Date().getFullYear()} Antoni Andre
* @license MIT
*/`
const bundlingConf = {
lib: {
entry: resolve(__dirname, '/src/richer-than-rich/index.vue'),
name: 'RicherThanRich',
formats: ['es', 'umd', 'cjs']
},
rollupOptions: {
plugins: [
// Rollup generates all the files, then remove what we don't want.
// Delete({ targets: ['dist/{images}', 'dist/*.{ico,txt,html}'], hook: 'generateBundle' })
],
// Make sure to externalize deps that shouldn't be bundled into library.
external: ['vue'],
output: {
banner,
// Provide global variables to use in the UMD build for externalized deps.
globals: { vue: 'Vue' },
entryFileNames: 'richer.[format].js',
chunkFileNames: '[name].js'
}
}
}
const build = process.env.BUNDLE ? bundlingConf : { outDir: 'docs' }
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue({
template: {
compilerOptions: { whitespace: 'preserve' }
}
})
],
resolve: {
alias: {
'@': resolve(__dirname, '/src')
}
},
css: {
preprocessorOptions: {
scss: {
additionalData: '@import "@/documentation/scss/variables";'
}
},
postcss: {
plugins: [autoprefixer]
}
},
build
})