-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathvite.config.js
More file actions
50 lines (46 loc) · 1.17 KB
/
vite.config.js
File metadata and controls
50 lines (46 loc) · 1.17 KB
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
const { defineConfig } = require('vite')
const pluginVue = require('@vitejs/plugin-vue')
const path = require('path')
const vue = pluginVue.default || pluginVue
module.exports = defineConfig(({ command }) => {
const isBuild = command === 'build'
const templatesRoot = path.resolve(__dirname, 'tabbycat/templates')
const tabbycatRoot = path.resolve(__dirname, 'tabbycat')
return {
root: templatesRoot,
base: isBuild ? '/static/vue/' : '/',
plugins: [vue()],
resolve: {
alias: {
vue: 'vue/dist/vue.esm-bundler.js',
},
},
server: {
port: 8888,
strictPort: true,
host: true,
cors: true,
headers: {
'Access-Control-Allow-Origin': '*',
},
fs: {
allow: [templatesRoot, tabbycatRoot],
},
},
build: {
outDir: '../static/vue',
emptyOutDir: true,
sourcemap: true,
rollupOptions: {
input: {
app: path.resolve(templatesRoot, 'js-bundles/main.js'),
},
output: {
entryFileNames: 'js/[name].js',
chunkFileNames: '[name].js',
assetFileNames: 'assets/[name][extname]',
},
},
},
}
})