UNPKG

520 BJavaScriptView Raw
1// eslint-disable-next-line import/no-unresolved
2import { chunkId } from "/.jsenv/BUNDLE_CONSTANTS.js"
3// eslint-disable-next-line import/no-unresolved
4import importMap from "/.jsenv/importMap.json"
5import { resolvePath } from "@jsenv/module-resolution"
6
7const { currentScript } = document
8
9export const url = (currentScript && currentScript.src) || new URL(chunkId, document.baseURI).href
10
11export const resolve = (specifier) => {
12 return resolvePath({ specifier, importer: url, importMap, defaultExtension: false })
13}