Skip to content

Instantly share code, notes, and snippets.

@metelkin
Created September 23, 2018 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save metelkin/0b1fea86487fa7333133990e294bed6d to your computer and use it in GitHub Desktop.
Save metelkin/0b1fea86487fa7333133990e294bed6d to your computer and use it in GitHub Desktop.
External parameters from webpack to code
// __PROCESS__ is object from webpack, see "webpack.config.js"
const parameter = __PROCESS__.parameter;
...
// regular webpack configuration
module.exports = {
plugins: [
new webpack.DefinePlugin({
'__PROCESS__': {
'parameter': `'${process.env.PARAM}'`, // here we pass enviromental parameter to code
}
})
]
...
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment