silphius/vite.config.js

53 lines
1012 B
JavaScript
Raw Normal View History

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