framework
framework copied to clipboard
Unresolved imports should error in fenced code blocks
We translate static imports to dynamic imports, but this should error rather than resolve to undefined:
import {doesNotExist} from "./module.js";
Currently the above is translated into (approximately):
const {doesNotExist} = await import("./_import/module.js");
We’ll need to do something like this instead:
const $module = await import("./_import/module.js");
if (!("doesNotExist" in $module)) throw new SyntaxError("The requested module './module.js' does not provide an export named 'doesNotExist'");
const {doesNotExist} = $module;
Where $module doesn’t collide with any referenced symbol.