Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit 73d72da

Browse files
committed
Fix build command for vue-loader
1 parent d8c5422 commit 73d72da

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

server/build.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { basename, dirname, extname, join } from "https://deno.land/[email protected]/
22
import { ensureDir } from "https://deno.land/[email protected]/fs/ensure_dir.ts";
33
import { build as esbuild, type Loader, stop } from "https://deno.land/x/[email protected]/mod.js";
44
import { parseExportNames } from "https://deno.land/x/[email protected]/mod.ts";
5-
import cache from "../lib/cache.ts";
65
import { existsDir, existsFile } from "../lib/fs.ts";
76
import { parseHtmlLinks } from "./html.ts";
87
import log from "../lib/log.ts";
@@ -45,6 +44,7 @@ export async function build(serverEntry?: string) {
4544
const platform = config?.build?.platform ?? "deno";
4645
const target = config?.build?.target ?? "es2020";
4746
const outputDir = join(workingDir, config?.build?.outputDir ?? "dist");
47+
const modulesProxyPort = Deno.env.get("ALEPH_MODULES_PROXY_PORT");
4848

4949
if (platform === "cloudflare" || platform === "vercel") {
5050
log.fatal(`Deploy to ${supportedPlatforms[platform]} is not supported yet`);
@@ -64,13 +64,20 @@ export async function build(serverEntry?: string) {
6464
if (config?.routes) {
6565
const { routes } = await initRoutes(config?.routes);
6666
routeFiles = await Promise.all(routes.map(async ([_, { filename }]) => {
67-
const code = await Deno.readTextFile(filename);
67+
let code: string;
68+
const ext = extname(filename).slice(1);
69+
if (builtinModuleExts.includes(ext)) {
70+
code = await Deno.readTextFile(filename);
71+
} else if (modulesProxyPort) {
72+
code = await fetch(`http://localhost:${modulesProxyPort}/${filename.slice(1)}`).then((res) => res.text());
73+
} else {
74+
throw new Error(`Unsupported module type: ${ext}`);
75+
}
6876
const exportNames = await parseExportNames(filename, code);
6977
return [filename, exportNames];
7078
}));
7179
}
7280

73-
const modulesProxyPort = Deno.env.get("ALEPH_MODULES_PROXY_PORT");
7481
const serverEntryCode = [
7582
`import { DependencyGraph } from "${alephPkgUri}/server/graph.ts";`,
7683
`import graph from "./server_dependency_graph.js";`,
@@ -211,7 +218,7 @@ export async function build(serverEntry?: string) {
211218
// bundle `server/transformer.ts` with `server/server_dist.ts` content
212219
url.pathname = util.trimSuffix(url.pathname, "transformer.ts") + "serve_dist.ts";
213220
}
214-
const res = await cache(url.href);
221+
const res = await fetch(url.href);
215222
const contents = await res.text();
216223
let ext = extname(url.pathname).slice(1);
217224
if (ext === "mjs") {

0 commit comments

Comments
 (0)