-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
56 lines (53 loc) · 1.39 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
/* eslint-disable @typescript-eslint/no-var-requires */
import { defineConfig, loadEnv } from 'vite';
import { resolve, join } from 'path';
import vue from '@vitejs/plugin-vue';
const INPUT_DIR = './django_vue_experiments/vite_assets';
const OUTPUT_DIR =
'./django_vue_experiments/vite_assets_dist/django_vue_experiments/vite';
const postcssConfig = {
plugins: [
require('postcss-import')(),
require('postcss-simple-vars')(),
require('tailwindcss/nesting')(),
require('tailwindcss')(),
require('autoprefixer')(),
],
};
export default defineConfig((mode) => {
const env = loadEnv(mode, process.cwd(), '');
return {
plugins: [vue()],
resolve: {
alias: {
'@': resolve(INPUT_DIR),
'vue': 'vue/dist/vue.esm-bundler.js',
},
},
root: resolve(INPUT_DIR),
base: '/static/',
css: {
postcss: postcssConfig,
},
server: {
host: '0.0.0.0',
port: env.DJANGO_VITE_DEV_SERVER_PORT,
},
build: {
manifest: true,
emptyOutDir: true,
target: 'es2015',
outDir: resolve(OUTPUT_DIR),
rollupOptions: {
input: {
css: join(INPUT_DIR, '/css/main.css.js'),
exp001: join(INPUT_DIR, '/js/apps/001_vue_mvp.ts'),
exp002b: join(INPUT_DIR, '/js/apps/002b_new_messages.ts'),
},
output: {
chunkFileNames: undefined,
},
},
},
};
});