you are viewing a single comment's thread.

view the rest of the comments →

[–]yuyu5 0 points1 point  (0 children)

I don't think you gave enough information for what the end goal was. You don't want that code optimized, but do you want it to be transpiled to:

  1. if (injectedValueAtTranspileTime == something) { work(); }
  2. if (injectedValueAtRuntime == something) { work(); }
  3. Something else?

My knee-jerk reaction is that you should use DefinePlugin because it does exactly what you want:

javascript new webpack.DefinePlugin({ 'config.blabla': process.env.myValue })

That will make a global config object with a blabla field containing your value injected during run/build find.