Skip to content
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

client vars are hard-coded by EnvironmentPlugin; can't be changed at launch time #164

Open
jedwards1211 opened this issue Jul 15, 2016 · 2 comments

Comments

@jedwards1211
Copy link
Contributor

jedwards1211 commented Jul 15, 2016

Issue - Bug

  • OS: OSX / Linux / Windows / ? OSX
  • Node version: 5.10.1
  • NPM version: 3.9.6
  • RethinkDB version: 2.3.0 (CLANG 7.3.0 (clang-703.0.29))

I'm building my app into a Docker container. Typically one wants to be able to run a Docker container on any server by simply changing environment variables like HOST. However, this would break the client bundle which has other values hard-coded in by EnvironmentPlugin. There's no way to deploy the app on a different host without rebuilding the js bundles. (One could build the js bundles in the docker container when it's launched, but that goes against docker best practices).

As a solution (I will PR soon) I propose turning off the process polyfill in the webpack config with node { process: false } and injecting our own process polyfill script in the Html SSR that includes desired environment variables from the server side. That way the process.env variables on the client side would always match those the server was run with.

@mattkrick
Copy link
Owner

very true. we've deployed action using dokku & although the devops isn't documented, you can see how we've handled environmental vars here https://github.com/ParabolInc/action/blob/master/webpack/webpack.config.prod.js#L9

@jedwards1211
Copy link
Contributor Author

That's the same as in meatier, right?
Check out my PR, I think you'll like it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants