Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
build(sheet): esbuild support preact alias
Dushusir76d2248ef1b0
diff --git a/examples/univer-sheet-ts/scripts/common.ts b/examples/univer-sheet-ts/scripts/common.tsindex 7c9d4984af..2349faf978 100644--- a/examples/univer-sheet-ts/scripts/common.ts+++ b/examples/univer-sheet-ts/scripts/common.ts@@ -11,6 +11,19 @@ export const paths = {out: resolve(root, "./dist"),outDev: resolve(root, "./local"),};++const preactCompatPlugin = {+ name: "preact-compat",+ setup(build) {+ const path = require("path");+ const preact = path.join(process.cwd(), "node_modules", "preact", "compat", "dist", "compat.module.js");++ build.onResolve({filter: /^(react-dom|react)$/}, args => {+ return {path: preact};+ });+ }+}+export const commonBuildOptions: BuildOptions = {entryPoints: [paths.entry],bundle: true,@@ -20,6 +33,7 @@ export const commonBuildOptions: BuildOptions = {},sourcemap: true,plugins: [+ preactCompatPlugin,stylePlugin({cssModulesOptions: {localsConvention: 'camelCaseOnly',diff --git a/examples/univer-sheet-ts/scripts/start.ts b/examples/univer-sheet-ts/scripts/start.tsindex 8cb2de6817..f2b000e9de 100644--- a/examples/univer-sheet-ts/scripts/start.ts+++ b/examples/univer-sheet-ts/scripts/start.ts@@ -11,6 +11,7 @@ import { Bright, FgCyan, FgGreen, Reset } from './color';}await promises.mkdir(paths.outDev);await promises.copyFile(paths.index, `${paths.outDev}/index.html`);+let ctx = await esbuild.context({...commonBuildOptions,outdir: paths.outDev,diff --git a/examples/univer-sheet-ts/tsconfig.json b/examples/univer-sheet-ts/tsconfig.jsonindex 7d8b1f32ba..620249146d 100644--- a/examples/univer-sheet-ts/tsconfig.json+++ b/examples/univer-sheet-ts/tsconfig.json@@ -20,11 +20,11 @@"baseUrl": "./","skipLibCheck": true,"esModuleInterop": true, // auto allowSyntheticDefaultImports true- "jsx": "preserve",- "jsxFactory": "h",- "jsxFragmentFactory": "Fragment",- // "jsx": "react-jsx",- // "jsxImportSource": "preact",+ // "jsx": "preserve",+ // "jsxFactory": "h",+ // "jsxFragmentFactory": "Fragment",+ "jsx": "react-jsx",+ "jsxImportSource": "preact","experimentalDecorators": true,"emitDecoratorMetadata": true,"suppressImplicitAnyIndexErrors": true,