2024-07-10 16:44:39 +00:00
|
|
|
import { cloudflareDevProxyVitePlugin as remixCloudflareDevProxy, vitePlugin as remixVitePlugin } from '@remix-run/dev';
|
|
|
|
import UnoCSS from 'unocss/vite';
|
|
|
|
import { defineConfig } from 'vite';
|
2024-07-17 18:54:46 +00:00
|
|
|
import { nodePolyfills } from 'vite-plugin-node-polyfills';
|
|
|
|
import { optimizeCssModules } from 'vite-plugin-optimize-css-modules';
|
2024-07-10 16:44:39 +00:00
|
|
|
import tsconfigPaths from 'vite-tsconfig-paths';
|
|
|
|
|
|
|
|
export default defineConfig((config) => {
|
|
|
|
return {
|
2024-07-17 19:31:47 +00:00
|
|
|
build: {
|
|
|
|
target: 'esnext',
|
|
|
|
},
|
2024-07-10 16:44:39 +00:00
|
|
|
plugins: [
|
2024-07-17 18:54:46 +00:00
|
|
|
nodePolyfills({
|
2024-07-25 15:28:23 +00:00
|
|
|
include: ['path', 'buffer'],
|
2024-07-17 18:54:46 +00:00
|
|
|
}),
|
2024-07-10 16:44:39 +00:00
|
|
|
config.mode !== 'test' && remixCloudflareDevProxy(),
|
|
|
|
remixVitePlugin({
|
|
|
|
future: {
|
|
|
|
v3_fetcherPersist: true,
|
|
|
|
v3_relativeSplatPath: true,
|
|
|
|
v3_throwAbortReason: true,
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
UnoCSS(),
|
|
|
|
tsconfigPaths(),
|
2024-07-17 18:54:46 +00:00
|
|
|
config.mode === 'production' && optimizeCssModules({ apply: 'build' }),
|
2024-07-10 16:44:39 +00:00
|
|
|
],
|
|
|
|
};
|
|
|
|
});
|