@chialab/esbuild-plugin-meta-url
Advanced tools
Comparing version 0.15.14 to 0.15.15
@@ -115,8 +115,10 @@ import path from 'path'; | ||
const usePlainScript = platform === 'browser' && format !== 'esm'; | ||
const isNode = platform === 'node' && format !== 'esm'; | ||
const baseUrl = (() => { | ||
if (platform === 'browser' && format !== 'esm') { | ||
return 'document.currentScript && document.currentScript.src || document.baseURI'; | ||
if (usePlainScript) { | ||
return '__currentScriptUrl__'; | ||
} | ||
if (platform === 'node' && format !== 'esm') { | ||
if (isNode) { | ||
return '\'file://\' + __filename'; | ||
@@ -187,2 +189,6 @@ } | ||
if (usePlainScript) { | ||
helpers.prepend('var __currentScriptUrl__ = document.currentScript && document.currentScript.src || document.baseURI;\n'); | ||
} | ||
return helpers.generate({ | ||
@@ -189,0 +195,0 @@ sourcemap: !!sourcemap, |
{ | ||
"name": "@chialab/esbuild-plugin-meta-url", | ||
"type": "module", | ||
"version": "0.15.14", | ||
"version": "0.15.15", | ||
"description": "A file loader plugin for esbuild for constructed URLs using import metadata.", | ||
@@ -45,3 +45,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "a48a62a5bbec43f2cc45d260e8f5f4e2b2b52759" | ||
"gitHead": "6e4a453cb0fcfaf02736a056698652ec7c38792b" | ||
} |
11061
186