-
Notifications
You must be signed in to change notification settings - Fork 76
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
Does not work with webpack-dev-server #78
Comments
Any good ways around this? Seeing the same thing. |
Hey @screendriver (and @jbailey), sorry somehow this issue slipped through the cracks. Just to jump-start me to get this resolved quickly, do you have a repo in progress/PR that I can look at to know more about your configuration? |
I use my Feel free to have a look. https://github.com/mrsteele/dotenv-webpack-example Of course, this is a minimally configured approach so it may or may not help you out. Since it can work I imagine you may have something else going on and conflicting with your variables. Since it has occurred more than once it may be a common problem but I am more than happy to investigate. |
Hmm, my webpack config looks the same, i just dont get the env variables from the file. I've tried in two different projects. I'm using webpack 2.2.1 for what it's worth. EDIT: I upgraded to webpack 3.5.6 without luck. |
I went ahead and upgraded everything and it still works. Do you have any other plugins that may be conflicting (historically that is what it ends up being).
|
I don't know how or what changed but in the meantime it's working on my machine 😳 🤔 |
Adding the |
For what it's worth, I use webpack-dev-server with dotenv-webpack without any issues. |
Haha from where I’m sitting @denizdogan it’s worth a lot! |
I just installed dotenv-webpack, and initially had the same issue as screendriver (OP), with it showing all the .env vars as undefined, but after killing the server a few times and rebuilding/restarting, it worked I know that doesn't help on this, just thought it was interesting |
Can confirm I'm also not seeing any issues using dotenv-webpack with webpack-dev-server. Worked first time. webpack: 3.11.0 |
Thanks @cbovis I'm going to assume this is resolved at this point but @screendriver if you think this is still a problem feel free to reopen. |
Hi @mrsteele, on my machine it works again. I don't know why but the main thing is it works 😁 So it's ok for me to close the issue 😉 |
In case anyone stumbles upon a similar issue, make sure you're not destructuring |
Hi,
it seems that
dotenv-webpack
does not work withwebpack-dev-server
. In my normal builds withoutwebpack-dev-server
I can see that the env variables are replaced as expected. But when I usewebpack-dev-server
all my env variables areundefined
.webpack: 3.5.5
webpack-dev-server: 2.7.1
dotenv-webpack: 1.5.4
The text was updated successfully, but these errors were encountered: