diff --git a/index.js b/index.js index c164c13..541c7b1 100644 --- a/index.js +++ b/index.js @@ -11,7 +11,8 @@ const importStyles = { iife: 'document.currentScript && document.currentScript.src || document.baseURI', umd: 'document.currentScript && document.currentScript.src || document.baseURI', system: 'module.meta.url', - baseURI: 'document.baseURI' + baseURI: 'document.baseURI', + location: 'self.location.href' }; module.exports = () => ({ diff --git a/test.js b/test.js index 5e0d5cc..cdf23cb 100644 --- a/test.js +++ b/test.js @@ -131,3 +131,10 @@ test('importStyle system', babelTest, { result: "const importMeta={url:new URL('./file.js',module.meta.url).href};console.log(importMeta.url);", importStyle: 'system' }); + +test('importStyle location', babelTest, { + source: 'console.log(import.meta.url);', + result: "const importMeta={url:new URL('./file.js',self.location.href).href};console.log(importMeta.url);", + importStyle: 'location' +}); +