Webpack's define plugin: variable is not defined
<p>I'm trying to pass some environment related variables into my React components using Webpack's DefinePlugin. Client side part works great, server side part returns 'MYVARIABLE is not defined'.</p>

<p>I'm using Webpack's Node.JS api. Important parts are below. Am I doing something wrong? Thanks</p>

<p>webpack.config.js</p>

<pre><code>...
webpackConfig.plugins = [
  new webpack.DefinePlugin({
    MYVARIABLE: 'test-value'
  })
]
...
</code></pre>

<p>server.js</p>

<pre><code>...
import webpack from 'webpack'
import webpackConfig from '../config/webpack.config'
...
var compiler = webpack(webpackConfig)
...
</code></pre>

<p>component file</p>

<pre><code>...
console.log(MYVARIABLE)
...
</code></pre>

<p>result</p>

<pre><code>ReferenceError: MYVARIABLE is not defined
....
</code></pre>