littledivy / deno_swc

The SWC compiler for Deno.
MIT License
114 stars 16 forks source link

Vendoring error #47

Open ghost opened 2 years ago

ghost commented 2 years ago

how to correctly vendor this?

$ cat ast.js        
import { parse } from "https://deno.land/x/swc@0.2.1/mod.ts";

const code = "const a = 44;";

const ast = parse(code, {
  syntax: "ecmascript",
  comments: false,
});

console.log(ast);
$ deno vendor ast.js
Vendored 5 modules into vendor/ directory.

To use vendored modules, specify the `--import-map vendor/import_map.json` flag when invoking Deno subcommands or add an `"importMap": "<path_to_vendored_import_map>"` entry to a deno.json file.
$ deno run --import-map=vendor/import_map.json ast.js
⚠️  ️Deno requests read access to "/home/0xcc07c9/deno_test/vendor/deno.land/x/swc@0.2.1/lib/deno_swc_bg.wasm". Run again with --allow-read to bypass this prompt.
   Allow? [y/n (y = yes allow, n = no deny)]  y
error: Uncaught (in promise) NotFound: No such file or directory (os error 2)
      const wasmCode = await Deno.readFile(wasm_url);
                       ^
    at async Object.readFile (deno:runtime/js/40_read_file.js:25:20)
    at async instantiateModule (file:///home/0xcc07c9/deno_test/vendor/deno.land/x/swc@0.2.1/lib/deno_swc.generated.js:346:24)
    at async file:///home/0xcc07c9/deno_test/vendor/deno.land/x/swc@0.2.1/lib/deno_swc.generated.js:314:27
    at async instantiate (file:///home/0xcc07c9/deno_test/vendor/deno.land/x/swc@0.2.1/lib/deno_swc.generated.js:292:11)
    at async file:///home/0xcc07c9/deno_test/vendor/deno.land/x/swc@0.2.1/mod.ts:9:49