fix build for windows

This commit is contained in:
proddy
2025-12-16 23:14:48 +01:00
parent 05f15f7876
commit f093df1cb9

View File

@@ -26,6 +26,9 @@ const RESOLVE_ALIASES = {
'react/jsx-runtime': 'preact/jsx-runtime' 'react/jsx-runtime': 'preact/jsx-runtime'
}; };
// Common resolve extensions - prioritize TypeScript/React files for Windows compatibility
const RESOLVE_EXTENSIONS = ['.tsx', '.ts', '.jsx', '.js', '.mjs', '.json'];
// Bundle file interface // Bundle file interface
interface BundleFile { interface BundleFile {
name: string; name: string;
@@ -101,7 +104,12 @@ const createBasePlugins = (
devToolsEnabled: boolean, devToolsEnabled: boolean,
includeBundleReporter = true includeBundleReporter = true
) => { ) => {
const plugins = [createPreactPlugin(devToolsEnabled), viteTsconfigPaths()]; const plugins = [
createPreactPlugin(devToolsEnabled),
viteTsconfigPaths({
projects: ['./tsconfig.json']
})
];
if (includeBundleReporter) { if (includeBundleReporter) {
plugins.push(bundleSizeReporter()); plugins.push(bundleSizeReporter());
} }
@@ -218,7 +226,8 @@ export default defineConfig(
return { return {
plugins: [...createBasePlugins(true, true), mockServer()], plugins: [...createBasePlugins(true, true), mockServer()],
resolve: { resolve: {
alias: RESOLVE_ALIASES alias: RESOLVE_ALIASES,
extensions: RESOLVE_EXTENSIONS
}, },
server: { server: {
open: true, open: true,
@@ -246,7 +255,8 @@ export default defineConfig(
return { return {
plugins: createBasePlugins(false, true), plugins: createBasePlugins(false, true),
resolve: { resolve: {
alias: RESOLVE_ALIASES alias: RESOLVE_ALIASES,
extensions: RESOLVE_EXTENSIONS
}, },
build: { build: {
...createBaseBuildConfig(), ...createBaseBuildConfig(),
@@ -279,7 +289,8 @@ export default defineConfig(
}) })
], ],
resolve: { resolve: {
alias: RESOLVE_ALIASES alias: RESOLVE_ALIASES,
extensions: RESOLVE_EXTENSIONS
}, },
build: { build: {
...createBaseBuildConfig(), ...createBaseBuildConfig(),