-
Notifications
You must be signed in to change notification settings - Fork 20
/
vite.config.js
78 lines (72 loc) · 2.31 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Vite config for FlexDash
// Copyright ©2021 Thorsten von Eicken, MIT license, see LICENSE file
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vuetify from 'vite-plugin-vuetify'
import visualizer from 'rollup-plugin-visualizer'
import * as path from 'path'
// https://vitejs.dev/config/
export default defineConfig(({mode}) => { return {
base: './',
plugins: [
vue(),
vuetify({ // https://github.com/vuetifyjs/vuetify-loader/tree/next/packages/vite-plugin
autoImport: true,
}),
visualizer({
filename: "stats/stats.html",
title: "FlexDash Rollup",
brotliSize: true,
gzipSize: true,
}),
],
resolve: { alias: [
// alias vuetify/lib for dev mode, without the use of new Vuetify components in external
// modules gets an error that vuetify/lib/components/VXxx is not found
{ find: 'vuetify/lib', replacement: path.resolve(__dirname, '/node_modules/vuetify/lib') },
]},
define: {
// pull-in the FlexDash version from package.json
'import.meta.env.PACKAGE_VERSION': JSON.stringify(process.env.npm_package_version)
},
// server: { fs: { allow: [ '.', '../mylib' ] }, },
build: {
//minify: false, // for debugging
target: 'esnext',
manifest: true,
chunkSizeWarningLimit: 600,
dynamicImportVarsOptions: { // don't eval/rewrite dynamic import statements
exclude: ["./src/utils/palette-loader.js"]
},
}
}})
//=== old stuff from various experiments, delete at some point...
// Use pre-built vue dist file:
// resolve: {
// alias: mode == 'production' ? {
// 'vue': 'vue/dist/vue.esm-browser.prod.js',
// } : {},
// },
// rollupOptions: {
// external: ['vue'], // don't include in bundle
// output: {
// paths: {
// vue: './vue.esm-browser.prod.js',
// },
// },
// plugins: [
// ],
// },
// Sample simple vite plugin:
// const path = require('path')
// function dynloader() { return {
// name: 'dynloader',
// resolveId(source, importer, opts) {
// if (source.match(/^vuetify\//)) {
// //const id = path.resolve(__dirname, 'node_modules', source)
// const id = path.join('/node_modules', source)
// console.log("********** resolveId: " + source + " from " + importer + " -> " + id) // " opts: " + JSON.stringify(opts))
// return id
// }
// }
// }}