import.meta.resolve should be synchronous
Author: tbrannamCreated May 8, 2025Updated May 19, 2025
SystemJS docs specify a Promise https://github.com/systemjs/systemjs/blob/main/docs/system-register.md#importmetaresolve-id-parenturl--promise
Documentation for import.resolve() suggests it returns a string. see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import.meta/resolve
When writing code like the following and using Rollup it will use the SystemJS context to implement import.resolve.
const url = import.resolve('./i18n/en-US.json')
// url should be a string, but when compiled and implemented as SystemJS module returns Promise<string>
// assertion will fail, as returned value is 'promise'
assert(typeof url === 'string') Both node and browser versions of SystemJS seem to have this issue.
Source: systemjs/systemjs