silphius/vite.config.js
2024-07-21 11:04:18 -05:00

53 lines
1012 B
JavaScript

import {readFileSync} from 'node:fs';
import {fileURLToPath} from 'node:url';
import {vitePlugin as remix} from '@remix-run/dev';
import react from '@vitejs/plugin-react';
import {defineConfig} from 'vite';
const cacheDirectory = `${import.meta.dirname}/node_modules/.cache`;
const plugins = [];
if (!process.env.STORYBOOK) {
plugins.push(
remix({
future: {
v3_fetcherPersist: true,
v3_relativeSplatPath: true,
v3_throwAbortReason: true,
},
}),
);
}
else {
plugins.push(react());
}
export default defineConfig({
esbuild: {
supported: {
'top-level-await': true,
},
},
plugins,
resolve: {
alias: [
{
find: '@',
replacement: fileURLToPath(new URL('./app', import.meta.url))
},
],
},
server: {
host: true,
https: {
key: readFileSync(`${cacheDirectory}/localhost-key.pem`),
cert: readFileSync(`${cacheDirectory}/localhost.pem`),
},
},
worker: {
format: 'es',
},
});