forked from VirtoCommerce/vc-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
54 lines (52 loc) · 1.39 KB
/
vite.config.ts
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
import { defineConfig, loadEnv } from "vite";
import path from "path";
import vue from "@vitejs/plugin-vue";
import graphqlPlugin from "@rollup/plugin-graphql";
import pluginI18n from "@intlify/vite-plugin-vue-i18n";
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
// https://stackoverflow.com/a/66389044
process.env = {
...process.env,
...loadEnv(mode, process.cwd(), "APP_"),
};
return {
envPrefix: "APP_",
plugins: [
vue(),
graphqlPlugin(),
pluginI18n({
globalSFCScope: false,
include: path.resolve(__dirname, "./locales/**"),
}),
],
resolve: {
alias: {
"@": path.resolve(__dirname, "./client-app"),
"@core": path.resolve(__dirname, "./client-app/core"),
},
},
base: mode === "production" ? "/themes/assets/" : "/",
build: {
outDir: "assets",
assetsDir: "./",
emptyOutDir: true,
rollupOptions: {
output: {
entryFileNames: "[name].js",
assetFileNames: "[name][extname]",
},
},
},
optimizeDeps: {
exclude: ["swiper/vue", "swiper/types"],
},
publicDir: "./client-app/public",
server: {
proxy: {
"/storefrontapi": `${process.env.APP_BACKEND_URL}`,
"/xapi": `${process.env.APP_BACKEND_URL}`,
},
},
};
});