Skip to content

import.meta.resolve should be synchronous #2503

@tbrannam

Description

@tbrannam

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.

return Promise.resolve(loader.resolve(id, parentUrl || parentId));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions