#3897·fresh

WASM 模块不起作用

作者: phaux创建于 2026年7月31日更新于 2026年7月31日

尝试在 /routes/api/[name].ts 中使用 @deno/doc:

typescript
import { doc } from "jsr:@deno/[email protected]";
import { define } from "../../utils.ts";

export const handler = define.handlers({
  async GET(ctx) {
    const { name } = ctx.params;
    const docs = await doc([`https://esm.sh/${name}`]);
    return Response.json(docs);
  },
});

错误: 无法解析源代码进行导入分析,因为内容包含无效的 JS 语法。您可能需要安装相应的插件来处理 .WASM 文件格式,或者如果这是一个资源,则在配置中将 "**/*.WASM" 添加到 assetsInclude 中。

内容来源: freshframework/fresh