ERR_UNSUPPORTED_RESOLVE_REQUEST


尝试解决无效的模块引荐来源网址。当使用以下任一方法导入或调用 import.meta.resolve() 时,可能会发生这种情况:

¥An attempt was made to resolve an invalid module referrer. This can happen when importing or calling import.meta.resolve() with either:

  • 一个裸说明符,它不是 URL 方案不是 file 的模块中的内置模块。

    ¥a bare specifier that is not a builtin module from a module whose URL scheme is not file.

  • 来自 URL 方案不是 特别计划 的模块的 相对网址

    ¥a relative URL from a module whose URL scheme is not a special scheme.

try {
  // Trying to import the package 'bare-specifier' from a `data:` URL module:
  await import('data:text/javascript,import "bare-specifier"');
} catch (e) {
  console.log(e.code); // ERR_UNSUPPORTED_RESOLVE_REQUEST
}