@import-meta-env/unplugin
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -486,3 +486,3 @@ var __create = Object.create; | ||
// package.json | ||
var version = "0.1.4"; | ||
var version = "0.1.5"; | ||
@@ -736,3 +736,3 @@ // ../shared/constant.ts | ||
default: | ||
if (isTransformingJs(code, id) || isTransformingSvelte(code, id)) { | ||
if (isTransformingJs(code, id)) { | ||
code = `import ${uniqueVariableName} from '${virtualFile}'; | ||
@@ -744,2 +744,12 @@ ` + code.replace(`import ${uniqueVariableName} from '${virtualFile}'; | ||
import ${uniqueVariableName} from '${virtualFile}';`); | ||
} else if (isTransformingSvelte(code, id)) { | ||
if (code.includes("<!-- This file is generated by @sveltejs/kit \u2014 do not edit it! -->")) { | ||
} else if (code.includes("<script ")) { | ||
code = code.replace(/(\<script.*?\>)/, `$1 | ||
import ${uniqueVariableName} from '${virtualFile}';`); | ||
} else { | ||
code = `import ${uniqueVariableName} from '${virtualFile}'; | ||
` + code.replace(`import ${uniqueVariableName} from '${virtualFile}'; | ||
`, ""); | ||
} | ||
} | ||
@@ -746,0 +756,0 @@ code = code.replace(/import\.meta\.env/g, uniqueVariableName); |
{ | ||
"name": "@import-meta-env/unplugin", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "Load environment variables into import.meta.env object", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
39035
947