-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
vite.config.js
63 lines (63 loc) · 1.46 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 mergeQueries from "postcss-merge-queries"
import autoprefixer from "autoprefixer"
import bundledWorker from './plugins/vite-plugin-bundled-worker';
import crossPlatform from './plugins/vite-plugin-cross-platform';
import path, { resolve, join } from 'path'
/**
* @type {import('vite').UserConfig}
* @see https://vitejs.dev/config/
*/
const root = join(process.cwd(), './src');
module.exports = {
mode: process.env.MODE,
base: '/',
root: root,
publicDir: "./public",
server: {
port: 1212,
fs: {
strict: false,
allow: ['./'],
},
hmr: false,
},
plugins: [
bundledWorker(),
crossPlatform("node"),
// tsconfigPaths(),
],
build: {
target: 'es2020',
polyfillDynamicImport: false,
minify: process.env.MODE === 'development' ? false : 'terser',
base: '/',
outDir: join(process.cwd(), 'dist'),
rollupOptions: {
input: {
main: resolve(__dirname, root, 'index.html'),
},
external: [
/^virtual:.*/,
]
},
assetsDir: '.',
emptyOutDir: true,
sourcemap: true,
},
css: {
postcss: {
plugins: [autoprefixer(), mergeQueries({ sort: true })]
},
preprocessorOptions: {
scss: { sourceMap: true }
}
},
resolve: {
alias: {
'@': resolve(__dirname, root),
"@src": resolve(__dirname, `./src`),
'/node_modules/': path.resolve(__dirname, 'node_modules/'),
"@wikijump": resolve(__dirname, 'modules/'),
},
},
};