Hi Svep, — env.NODE_ENV
Adeel Imran
1

Hi Adeel, tnx for quick answer!

Anyway, I can’t get DefinePlugin working :/ For example if I try to set MYVARIABLE and then use it in app.js, I get in console.log error undefined variable. I use:

const productionConfiguration = function (env) {
return {
plugins: [
new webpack.DefinePlugin({ MYVARIABLE: JSON.stringify('test-value') })
]
};
}

and

import React from 'react';
import { render } from 'react-dom';
import './styles.scss';

console.log(MYVARIABLE);

const App = () => {
return (
<div>
<h3>Our Application Is Alive</h3>
<p>This isn’t reality. This — is fantasy.</p>
<p>Yes I am quoting Star Trek I cant help it.</p>
</div>
);
}

render(<App />, document.getElementById('app'));

But it seems I am not the only one who cant use DefinePlugin :/

Like what you read? Give Svep AB a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.