Skip to content

Commit

Permalink
add proper env in vite config
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadim Ritter committed Aug 27, 2024
1 parent 2d6b3f2 commit 460b965
Showing 1 changed file with 55 additions and 48 deletions.
103 changes: 55 additions & 48 deletions client/vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -6,54 +6,61 @@ import { gitTagPlugin } from "./src/plugins/vite-plugin-git-tag";
import { viteEnvs } from "vite-envs";

// Utilities
import { defineConfig } from "vite";
import { defineConfig, loadEnv } from "vite";
import { fileURLToPath, URL } from "node:url";


export default defineConfig({
plugins: [

vue({
template: { transformAssetUrls }
}),

vuetify({
autoImport: true,
}),

VueI18nPlugin({
include: fileURLToPath(new URL("./src/i18n/locales/**", import.meta.url)),
}),

viteEnvs({
declarationFile: ".env.declaration"
})

// gitTagPlugin()

],

base: process.env.VITE_BASE_PATH || "",

define: {
"process.env": {},
_global: ({})
},
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url))
},
extensions: [
".js",
".json",
".jsx",
".mjs",
".ts",
".tsx",
".vue",
],
},
server: {
port: 8081,
},
})
export default ({ mode }) => {
process.env = {...process.env, ...loadEnv(mode, process.cwd())};

return defineConfig({

plugins: [

vue({
template: { transformAssetUrls }
}),

vuetify({
autoImport: true,
}),

VueI18nPlugin({
include: fileURLToPath(new URL("./src/i18n/locales/**", import.meta.url)),
}),

viteEnvs({
declarationFile: ".env.declaration"
})

// gitTagPlugin()

],

base: process.env.VITE_BASE_PATH || "",

define: {
"process.env": {},
_global: ({})
},

resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url))
},
extensions: [
".js",
".json",
".jsx",
".mjs",
".ts",
".tsx",
".vue",
],
},

server: {
port: 8081,
},
});
}

0 comments on commit 460b965

Please sign in to comment.