-
-
Notifications
You must be signed in to change notification settings - Fork 375
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
Is there an agreed upon way to have environment variables in the application ? #463
Comments
You can add whatever you want via // preact.config.js
const webpack = require('webpack');
module.exports = function (config) {
config.plugins.push(
new webpack.DefinePlugin({
SECRET: JSON.stringify('my-secret'),
PASSWORD: JSON.stringify('my-password')
});
);
} A lot of people also choose to use We're not opinionated on what you do because (1) it's a really personal choice and (2) there are lots and lots of options out there. 😄 |
does dotenv work with webpack? |
I've been using https://github.com/robinvdvleuten/preact-cli-plugin-env-vars to great success. |
I will just say that I'm not super happy with using .env variables for FE development. |
I like using env values to separate production and development URLs, or test with custom URLs. For example, I can build an environment for a PR and override the URL of our API to specialised staging URL for the PR. It has its uses, and yes, agreed that there are no secrets in the frontend land. |
In Angular-CLI they have a very straightforward way: https://github.com/angular/angular-cli/wiki/stories-application-environments
Before implementing my own solution I would like to be sure there isn't already a way that most people are using and agreeing upon.
The text was updated successfully, but these errors were encountered: