react-dotenv
Advanced tools
Comparing version
{ | ||
"name": "react-dotenv", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Load environment variables dynamically for your React applications created with CRA (Create-React-App).", | ||
@@ -5,0 +5,0 @@ "author": "Jese", |
@@ -24,2 +24,8 @@ #!/usr/bin/env node | ||
/** | ||
* Check for custom homepage (basepath) | ||
* More Info: https://create-react-app.dev/docs/deployment/#building-for-relative-paths | ||
*/ | ||
const homepage = get(appPackage, "homepage", "."); | ||
/** | ||
* Remove all environment variables | ||
@@ -62,5 +68,5 @@ * not included in the whitelist | ||
if ($("script#react-dotenv").length) { | ||
$("script#react-dotenv").attr("src", "./env.js"); | ||
$("script#react-dotenv").attr("src", `${homepage}/env.js`); | ||
} else { | ||
$("head").append('\t<script id="react-dotenv" src="./env.js"></script>\n\t'); | ||
$("head").append(`\t<script id="react-dotenv" src="${homepage}/env.js"></script>\n\t`); | ||
} | ||
@@ -67,0 +73,0 @@ |
6226
3.46%62
8.77%