Skip to content

Commit

Permalink
fix: ser again
Browse files Browse the repository at this point in the history
  • Loading branch information
NeOMakinG committed Feb 26, 2025
1 parent bad7a10 commit ecaaab8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion vite.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const publicFilesEnvVars = {
}

const publicPath = path.join(__dirname, 'public')

for (const dirent of fs.readdirSync(publicPath, { withFileTypes: true })) {
if (!dirent.isFile()) continue
const mungedName = dirent.name
Expand All @@ -44,7 +45,7 @@ for (const dirent of fs.readdirSync(publicPath, { withFileTypes: true })) {
publicFilesEnvVars[`VITE_CID_${mungedName}`] = JSON.stringify(cid)
}

export default defineConfig(({ mode }) => {
export default defineConfig(() => {
const actualMode = determineMode()

const env = {
Expand All @@ -66,6 +67,12 @@ export default defineConfig(({ mode }) => {
}),
],
define: {
...Object.fromEntries(
Object.entries(publicFilesEnvVars).map(([key, value]) => [`import.meta.env.${key}`, value]),
),
...Object.fromEntries(
Object.entries(publicFilesEnvVars).map(([key, value]) => [`process.env.${key}`, value]),
),
...Object.fromEntries(
Object.entries(env).map(([key, value]) => [
`import.meta.env.${key}`,
Expand Down

0 comments on commit ecaaab8

Please sign in to comment.