-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support import.meta.env
#127
Comments
Find this beatiful lib: https://iendeavor.github.io/import-meta-env/guide/getting-started/compile-time-transform.html by @iendeavor |
Hmm i might drop some features like dotenv. |
EDIT: Nevermind part 2, I should've tried harder. I just needed to install // index.ts
import * as dotenv from "dotenv";
dotenv.config();
console.log(import.meta.env.SECRET); That said, still running into some funkiness with a file that looks like the following: // index.ts
import { someFunction } from "./someFunction"
someFunction()
// someFunction.ts
...
const thirdParty = new ThirdPartyClient({ auth: import.meta.env.AUTH_TOKEN })
function someFunction() {
thirdParty.something(...)
} The above won't work because EDIT: Nevermind, I see you have to reference a specific value, like // .env
SECRET=hello
// index.ts
console.log(import.meta.env.SECRET)
// > undefined
|
Yes, the way currently plugin works is that you need explicit |
#101 (comment)
The text was updated successfully, but these errors were encountered: