changed some stuff
This commit is contained in:
1 parent
f7d08e85d5
commit
ed81250fb3
3 files changed
+14
-11
No files matched your search
@@ -312,6 +312,7 @@
|
|||||||
"https://deno.land/x/denoflate@1.2.1/pkg/denoflate_bg.wasm.js": "d581956245407a2115a3d7e8d85a9641c032940a8e810acbd59ca86afd34d44d",
|
"https://deno.land/x/denoflate@1.2.1/pkg/denoflate_bg.wasm.js": "d581956245407a2115a3d7e8d85a9641c032940a8e810acbd59ca86afd34d44d",
|
||||||
"https://deno.land/x/esbuild@v0.14.51/mod.js": "7432566c71fac77637822dc230319c7392a2d2fef51204c9d12c956d7093c279",
|
"https://deno.land/x/esbuild@v0.14.51/mod.js": "7432566c71fac77637822dc230319c7392a2d2fef51204c9d12c956d7093c279",
|
||||||
"https://deno.land/x/esbuild@v0.14.51/wasm.js": "afc1b6927543b664af60ce452c4929e5dc2bb9a0f4ed47b446a6431847c7598e",
|
"https://deno.land/x/esbuild@v0.14.51/wasm.js": "afc1b6927543b664af60ce452c4929e5dc2bb9a0f4ed47b446a6431847c7598e",
|
||||||
|
"https://deno.land/x/esbuild@v0.19.2/mod.js": "d619154b9c1cc70e8ee4b8db94fb01f00767c9e83089c135cede0cd3edd342a0",
|
||||||
"https://deno.land/x/esbuild@v0.19.6/mod.js": "60e627081a3309803115fe336274209164d99876c6e30dbe322f0d74700f4488",
|
"https://deno.land/x/esbuild@v0.19.6/mod.js": "60e627081a3309803115fe336274209164d99876c6e30dbe322f0d74700f4488",
|
||||||
"https://deno.land/x/esbuild_deno_loader@0.5.2/deps.ts": "bf83c27b7787b2f245fa0bc0b99f5041aa949c000a81c016cfe828d06b476d37",
|
"https://deno.land/x/esbuild_deno_loader@0.5.2/deps.ts": "bf83c27b7787b2f245fa0bc0b99f5041aa949c000a81c016cfe828d06b476d37",
|
||||||
"https://deno.land/x/esbuild_deno_loader@0.5.2/mod.ts": "bc111a68f323dbdb6edec68dd558ab732b27866d2ef304708872d763387b65d7",
|
"https://deno.land/x/esbuild_deno_loader@0.5.2/mod.ts": "bc111a68f323dbdb6edec68dd558ab732b27866d2ef304708872d763387b65d7",
|
||||||
|
|||||||
+6
-5
@@ -3,7 +3,8 @@
|
|||||||
* See https://github.com/denoland/fresh/blob/main/src/server/bundle.ts
|
* See https://github.com/denoland/fresh/blob/main/src/server/bundle.ts
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as esbuildNative from "https://deno.land/x/esbuild@v0.19.6/mod.js";
|
import * as esbuild from "https://deno.land/x/esbuild@v0.19.2/mod.js";
|
||||||
|
|
||||||
import { denoPlugins } from "https://deno.land/x/esbuild_deno_loader@0.8.2/mod.ts";
|
import { denoPlugins } from "https://deno.land/x/esbuild_deno_loader@0.8.2/mod.ts";
|
||||||
|
|
||||||
|
|
||||||
@@ -13,7 +14,7 @@ async function verifyEsbuildInitialized(): Promise<void> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log(new Date(), "start initializing esbuild");
|
console.log(new Date(), "start initializing esbuild");
|
||||||
await esbuildNative.initialize({});
|
await esbuild.initialize({});
|
||||||
|
|
||||||
esbuildInitialized = true;
|
esbuildInitialized = true;
|
||||||
console.log(new Date(), "esbuild initialized");
|
console.log(new Date(), "esbuild initialized");
|
||||||
@@ -27,7 +28,7 @@ export async function createBundle(
|
|||||||
await verifyEsbuildInitialized();
|
await verifyEsbuildInitialized();
|
||||||
console.log(new Date(), "Bundling", entryPoint.href);
|
console.log(new Date(), "Bundling", entryPoint.href);
|
||||||
const absWorkingDir = Deno.cwd();
|
const absWorkingDir = Deno.cwd();
|
||||||
const res = await esbuildNative.build({
|
const res = await esbuild.build({
|
||||||
bundle: true,
|
bundle: true,
|
||||||
entryPoints: [entryPoint.href],
|
entryPoints: [entryPoint.href],
|
||||||
platform: "neutral",
|
platform: "neutral",
|
||||||
@@ -35,12 +36,12 @@ export async function createBundle(
|
|||||||
minify: !isDev,
|
minify: !isDev,
|
||||||
sourcemap: isDev ? "inline" : false,
|
sourcemap: isDev ? "inline" : false,
|
||||||
outfile: "",
|
outfile: "",
|
||||||
absWorkingDir,
|
absWorkingDir: Deno.env.get('XDG_CACHE_HOME') ,
|
||||||
outdir: ".",
|
outdir: ".",
|
||||||
target: ["chrome99", "firefox99", "safari15"],
|
target: ["chrome99", "firefox99", "safari15"],
|
||||||
write: false,
|
write: false,
|
||||||
format: "esm",
|
format: "esm",
|
||||||
plugins: [...denoPlugins({ importMapURL })],
|
plugins: [...denoPlugins({ importMapURL: importMapURL.href })],
|
||||||
splitting: false,
|
splitting: false,
|
||||||
jsx: "automatic",
|
jsx: "automatic",
|
||||||
jsxImportSource: "react",
|
jsxImportSource: "react",
|
||||||
|
|||||||
+7
-6
@@ -10,7 +10,7 @@ type QuestionAnswer = {
|
|||||||
|
|
||||||
const router = new Router();
|
const router = new Router();
|
||||||
|
|
||||||
const clientBundle = createBundle(
|
const prodClientBundle = createBundle(
|
||||||
new URL("./client.ts", import.meta.url),
|
new URL("./client.ts", import.meta.url),
|
||||||
new URL("../import_map.json", import.meta.url),
|
new URL("../import_map.json", import.meta.url),
|
||||||
false,
|
false,
|
||||||
@@ -187,11 +187,12 @@ router.get("/api/v1/results", async (context): Promise<void> => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
router.get("/client.js", async (context): Promise<void> => {
|
router.get("/client.js", async (context): Promise<void> => {
|
||||||
context.response.body = await createBundle(
|
context.response.body = await prodClientBundle;
|
||||||
new URL("./client.ts", import.meta.url),
|
// context.response.body = await createBundle(
|
||||||
new URL("../import_map.json", import.meta.url),
|
// new URL("./client.ts", import.meta.url),
|
||||||
false,
|
// new URL("../import_map.json", import.meta.url),
|
||||||
);
|
// true,
|
||||||
|
// );
|
||||||
context.response.type = "application/javascript";
|
context.response.type = "application/javascript";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user