I have read all of the articles here at stack overflow and about 200 more from google searches and i, for the life of me, can\'t get my head around process.env. No matter wh
The DefinePlugin
configuration you're using replaces occurrences of process.env.NODE_ENV
expressions in your code with whichever value you configure - it won't touch references to process.env
, as you haven't told it to do anything with that exact expression - the configuration you're using is just shorthand for replacing multiple expressions which share a common root.
Webpack is detecting that you're referencing a global process
variable and is injecting the process mock from node-libs-browser, which as you can see defines an empty env
object.
You can use node Webpack config to control this. Adding node: {process: false}
to your config will disable injection of a mock for process
.