You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I follow the readme and write a simple script to bundle my application I get something like this:
import { bundle } from "https://deno.land/x/[email protected]/mod.ts";
const url: string = import.meta.resolve('./main.ts');
const { code } = await bundle(url);
// write 'code' into a file
Which works as long as we are not using import maps in the application.
If you try to use import maps you will just get a cryptic error:
error: Uncaught (in promise) Error: Unable to output during bundling.
const ret = new Error(getStringFromWasm0(arg0, arg1));
Passing the used import map into the bundle() function will solve this: const { code } = await bundle(url, {importMap: './deno.json'});
This should be documented in the readme. I just spend an hour trying to figure out why my build suddenly stopped working after updating a couple of dependencies and introducing import maps.
The text was updated successfully, but these errors were encountered:
I am unsure about documenting how to use import maps specifically. The documentation is already very sparse.
I think what should be made clearer is that it is a relatively low-level library. It does not come with Deno's bells and whistles. A user should not expect the library to automatically resolve Deno configuration files, as those are for the CLI.
Document how to bundle with import maps.
When I follow the readme and write a simple script to bundle my application I get something like this:
Which works as long as we are not using import maps in the application.
If you try to use import maps you will just get a cryptic error:
Passing the used import map into the
bundle()
function will solve this:const { code } = await bundle(url, {importMap: './deno.json'});
This should be documented in the readme. I just spend an hour trying to figure out why my build suddenly stopped working after updating a couple of dependencies and introducing import maps.
The text was updated successfully, but these errors were encountered: