Skip to content

Commit

Permalink
fix: load dev proxy plugin only on dev
Browse files Browse the repository at this point in the history
  • Loading branch information
aube-dev committed Sep 14, 2024
1 parent 53ed9a1 commit 72395a6
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,25 @@ import { vitePlugin as remix } from '@remix-run/dev';
import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin';
import { defineConfig } from 'vite';
import tsconfigPaths from 'vite-tsconfig-paths';
import { remixCloudflareDevProxyVitePlugin } from './server';

export default defineConfig({
plugins: [
remixCloudflareDevProxyVitePlugin(),
remix({
future: {
v3_fetcherPersist: true,
v3_relativeSplatPath: true,
v3_throwAbortReason: true,
},
}),
tsconfigPaths(),
vanillaExtractPlugin(),
],
export default defineConfig(async ({ command }) => {
const { remixCloudflareDevProxyVitePlugin } =
command === 'serve'
? await import('./server')
: { remixCloudflareDevProxyVitePlugin: undefined };

return {
plugins: [
remixCloudflareDevProxyVitePlugin?.(),
remix({
future: {
v3_fetcherPersist: true,
v3_relativeSplatPath: true,
v3_throwAbortReason: true,
},
}),
tsconfigPaths(),
vanillaExtractPlugin(),
].filter((item) => item !== undefined),
};
});

0 comments on commit 72395a6

Please sign in to comment.