From 8185852c5a036c63616917b7d2a0ede89de339a9 Mon Sep 17 00:00:00 2001 From: Seth Trowbridge Date: Mon, 3 Jun 2024 14:51:40 -0400 Subject: [PATCH] init snippet --- bundler.tsx | 25 +++++++++++++++++++------ deno.json | 4 ++-- deno.lock | 5 ----- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/bundler.tsx b/bundler.tsx index 75c5b53..027b907 100644 --- a/bundler.tsx +++ b/bundler.tsx @@ -1,14 +1,27 @@ -import "other"; -import * as ESBuild from "https://deno.land/x/esbuild@v0.19.11/mod.js"; +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 result = await ESBuild.build({ + +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: [import.meta.resolve("entry")], + entryPoints: ["http://localhost:4507/app.tsx"], bundle: true, minify: true, jsx:"automatic", jsxImportSource:"react", format: "esm", -} as ESBuild.BuildOptions); -console.log(result.outputFiles); \ No newline at end of file +} as ESBuild.BuildOptions + + +const result = await ESBuild.build(options); +console.log(result.outputFiles); +ESBuild.stop(); \ No newline at end of file diff --git a/deno.json b/deno.json index 9d2d473..1f32932 100644 --- a/deno.json +++ b/deno.json @@ -2,8 +2,8 @@ "imports": { "react": "https://esm.sh/preact@10.22.0/compat", "react/": "https://esm.sh/preact@10.22.0/compat/", - "other": "./other.tsx", - "entry": "./app.tsx" + "other": "http://localhost:4507/other.tsx", + "entry": "http://localhost:4507/app.tsx" }, "compilerOptions": { "jsx": "react-jsx", diff --git a/deno.lock b/deno.lock index b765241..75d3833 100644 --- a/deno.lock +++ b/deno.lock @@ -136,10 +136,6 @@ "https://deno.land/x/deno_cache@0.6.2/lib/snippets/deno_cache_dir-a2aecaa9536c9402/fs.js": "cbe3a976ed63c72c7cb34ef845c27013033a3b11f9d8d3e2c4aa5dda2c0c7af6", "https://deno.land/x/deno_cache@0.6.2/mod.ts": "b4004287e1c6123d7f07fe9b5b3e94ce6d990c4102949a89c527c68b19627867", "https://deno.land/x/deno_cache@0.6.2/util.ts": "f3f5a0cfc60051f09162942fb0ee87a0e27b11a12aec4c22076e3006be4cc1e2", - "https://deno.land/x/denoflate@1.2.1/mod.ts": "f5628e44b80b3d80ed525afa2ba0f12408e3849db817d47a883b801f9ce69dd6", - "https://deno.land/x/denoflate@1.2.1/pkg/denoflate.js": "b9f9ad9457d3f12f28b1fb35c555f57443427f74decb403113d67364e4f2caf4", - "https://deno.land/x/denoflate@1.2.1/pkg/denoflate_bg.wasm.js": "d581956245407a2115a3d7e8d85a9641c032940a8e810acbd59ca86afd34d44d", - "https://deno.land/x/esbuild@v0.19.11/mod.js": "bd4916647799a0cd046dcf4eafd6ace09d22d5898870bd062206b8b6343d5e6a", "https://deno.land/x/esbuild@v0.19.11/wasm.js": "e5935e262c7b5b3ed4d842e780293d6ff7132c9ddc3077b31ae305c73c741e7b", "https://deno.land/x/esbuild_deno_loader@0.9.0/deps.ts": "08972bc7edd45e9e57cfc9f9a8628957c58913dcc96273806d7c228edbb7711f", "https://deno.land/x/esbuild_deno_loader@0.9.0/mod.ts": "00decaf22c0fec5d80724f0bb48caeafe936f5f75e31bb1138a970961fac0bbd", @@ -151,7 +147,6 @@ "https://deno.land/x/esbuild_deno_loader@0.9.0/src/shared.ts": "d717f56adafcee47834d20b77d603f646d36575273c766fcb34d6315e759392f", "https://deno.land/x/importmap@0.2.1/_util.ts": "ada9a9618b537e6c0316c048a898352396c882b9f2de38aba18fd3f2950ede89", "https://deno.land/x/importmap@0.2.1/mod.ts": "ae3d1cd7eabd18c01a4960d57db471126b020f23b37ef14e1359bbb949227ade", - "https://esm.sh/preact@10.22.0/compat": "88368f5ecd284b0666d5ff8fbf7bb69ea131e7e947ad54f2fa24f5035b674b41", "https://esm.sh/preact@10.22.0/compat/jsx-runtime": "a2f6ddc2ce374813df1c13826a9ad010e90b5a70a989f1069a367ef60dd52eb0", "https://esm.sh/stable/preact@10.22.0/denonext/compat.js": "7c0b206984707cfef58efae492ea8d5212b8f620dd8c83294a5c832fb422c766", "https://esm.sh/stable/preact@10.22.0/denonext/compat/jsx-runtime.js": "fecfa3df69d580507801575175087de9a2a9fc23bb4900004a1f4cbd5b362634",