What problem does this feature solve?
webpack support config node-module in node.__filename and node.__dirname
This is useful for shims of esm bundle artifacts.
What does the proposed API look like?
const getImportMetaUrl = () =>
typeof document === 'undefined'
? new URL('file:' + __filename).href
: (document.currentScript && document.currentScript.src) ||
new URL('main.js', document.baseURI).href
export const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()
What problem does this feature solve?
webpack support config
node-modulein node.__filename and node.__dirnameThis is useful for shims of esm bundle artifacts.
What does the proposed API look like?
import.meta.url.