-
Notifications
You must be signed in to change notification settings - Fork 12
/
vite.config.js
48 lines (46 loc) · 1.21 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
import { defineConfig } from "vite";
import legacy from "@vitejs/plugin-legacy";
import { createVuePlugin } from "vite-plugin-vue2";
import viteCompression from "vite-plugin-compression";
import path from "path";
import { viteStaticCopy } from 'vite-plugin-static-copy';
const HOST = "0.0.0.0";
const REPLACEMENT = `${path.resolve(__dirname, "./src")}/`;
export default (/** if you want to use mode : { mode }*/) => {
return defineConfig({
base: "./",
server: {
host: HOST,
port: process.env.PORT,
},
resolve: {
extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json", ".vue"], // .vue added
alias: [
{
find: "@/",
replacement: REPLACEMENT,
},
{
find: "src/",
replacement: REPLACEMENT,
},
],
},
plugins: [
viteStaticCopy({
targets: [
{
src: path.resolve(__dirname, './node_modules/amis/sdk') + '/[!.]*',
dest: 'amis/sdk'
}
]
}),
createVuePlugin(/* options */),
legacy({
targets: ["ie >= 11"],
additionalLegacyPolyfills: ["regenerator-runtime/runtime"],
}),
viteCompression(),
],
});
};