Skip to content

Commit

Permalink
🐛 Fix wrong target path for vite
Browse files Browse the repository at this point in the history
  • Loading branch information
AJR07 committed Jul 6, 2024
1 parent 28dac39 commit a9ab089
Showing 1 changed file with 19 additions and 29 deletions.
48 changes: 19 additions & 29 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,24 @@
import { sveltekit } from "@sveltejs/kit/vite";
import { defineConfig, loadEnv } from "vite";
import { defineConfig } from "vite";
import { NodeGlobalsPolyfillPlugin } from "@esbuild-plugins/node-globals-polyfill";
import { fileURLToPath, URL } from "node:url";

export default ({ mode }: { mode: string }) => {
const env = loadEnv(mode, process.cwd(), "");

return defineConfig({
plugins: [sveltekit()],
optimizeDeps: {
esbuildOptions: {
// Node.js global to browser globalThis
define: {
global: "globalThis",
},
// Enable esbuild polyfill plugins
plugins: [
NodeGlobalsPolyfillPlugin({
buffer: true,
}),
],
},
},
define: {
"process.env": env,
},
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
export default defineConfig({
plugins: [sveltekit()],
optimizeDeps: {
esbuildOptions: {
// Node.js global to browser globalThis
define: {
global: "globalThis",
},
// Enable esbuild polyfill plugins
plugins: [
NodeGlobalsPolyfillPlugin({
buffer: true,
}),
],
},
});
};
},
build: {
target: "ES2022",
},
});

0 comments on commit a9ab089

Please sign in to comment.