27 lines
856 B
TypeScript
27 lines
856 B
TypeScript
import * as ESBuild from "https://deno.land/x/esbuild@v0.19.11/wasm.js";
|
|
import * as ESBuildDeno from "https://deno.land/x/esbuild_deno_loader@0.9.0/mod.ts";
|
|
|
|
|
|
const importMap = {imports: {
|
|
"react": "https://esm.sh/preact@10.22.0/compat",
|
|
"react/": "https://esm.sh/preact@10.22.0/compat/",
|
|
"other": "http://localhost:4507/other.tsx",
|
|
"entry": "http://localhost:4507/app.tsx"
|
|
}}
|
|
|
|
await ESBuild.initialize({worker:false} as ESBuild.InitializeOptions);
|
|
|
|
const options = {
|
|
plugins: [...ESBuildDeno.denoPlugins({configPath:Deno.cwd()+"/deno.json"} as ESBuildDeno.DenoPluginsOptions)],
|
|
entryPoints: ["http://localhost:4507/app.tsx"],
|
|
bundle: true,
|
|
minify: true,
|
|
jsx:"automatic",
|
|
jsxImportSource:"react",
|
|
format: "esm",
|
|
} as ESBuild.BuildOptions
|
|
|
|
|
|
const result = await ESBuild.build(options);
|
|
console.log(result.outputFiles);
|
|
ESBuild.stop(); |