Define a webpack plugin that pulls version information from package.json.
Last active
September 21, 2017 15:04
-
-
Save dgrebb/02c1d720d1bcd7c7b0efada38cc7d8bb to your computer and use it in GitHub Desktop.
webpack version plugin
This file contains hidden or 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
| // any-module.js | |
| console.log("Version: " + VERSION); |
This file contains hidden or 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
| // webpack.config.js | |
| plugins: [ | |
| new webpack.DefinePlugin({ | |
| VERSION: JSON.stringify(require("package.json").version) | |
| }) | |
| ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment