feat(react): set up client to support Preact with JSX

This commit is contained in:
Elian Doran 2025-08-03 13:28:40 +03:00
parent 425ade5212
commit 3361a2e4ab
No known key found for this signature in database
3 changed files with 8 additions and 1 deletions

View file

@ -59,6 +59,7 @@
}, },
"devDependencies": { "devDependencies": {
"@ckeditor/ckeditor5-inspector": "5.0.0", "@ckeditor/ckeditor5-inspector": "5.0.0",
"@preact/preset-vite": "2.10.2",
"@types/bootstrap": "5.2.10", "@types/bootstrap": "5.2.10",
"@types/jquery": "3.5.32", "@types/jquery": "3.5.32",
"@types/leaflet": "1.9.20", "@types/leaflet": "1.9.20",

View file

@ -4,9 +4,13 @@
"lib": [ "ESNext" ], "lib": [ "ESNext" ],
"outDir": "dist", "outDir": "dist",
"types": [ "types": [
"node" "node",
"preact"
], ],
"rootDir": "src", "rootDir": "src",
"jsx": "preserve",
"jsxFactory": "h",
"jsxImportSource": "preact",
"module": "esnext", "module": "esnext",
"moduleResolution": "bundler", "moduleResolution": "bundler",
"tsBuildInfoFile": "dist/tsconfig.app.tsbuildinfo" "tsBuildInfoFile": "dist/tsconfig.app.tsbuildinfo"

View file

@ -4,6 +4,7 @@ import { defineConfig, type Plugin } from 'vite';
import { viteStaticCopy } from 'vite-plugin-static-copy' import { viteStaticCopy } from 'vite-plugin-static-copy'
import asset_path from './src/asset_path'; import asset_path from './src/asset_path';
import webpackStatsPlugin from 'rollup-plugin-webpack-stats'; import webpackStatsPlugin from 'rollup-plugin-webpack-stats';
import preact from "@preact/preset-vite";
const assets = [ "assets", "stylesheets", "fonts", "translations" ]; const assets = [ "assets", "stylesheets", "fonts", "translations" ];
@ -20,6 +21,7 @@ export default defineConfig(() => ({
host: 'localhost', host: 'localhost',
}, },
plugins: [ plugins: [
preact(),
viteStaticCopy({ viteStaticCopy({
targets: assets.map((asset) => ({ targets: assets.map((asset) => ({
src: `src/${asset}/*`, src: `src/${asset}/*`,