Created
September 23, 2018 18:42
-
-
Save metelkin/0b1fea86487fa7333133990e294bed6d to your computer and use it in GitHub Desktop.
External parameters from webpack to code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// __PROCESS__ is object from webpack, see "webpack.config.js" | |
const parameter = __PROCESS__.parameter; | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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