Skip to content

Instantly share code, notes, and snippets.

@joshjung
Created November 14, 2017 11:26
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 joshjung/dc1478b6ab744e43b0752fc877393b3a to your computer and use it in GitHub Desktop.
Save joshjung/dc1478b6ab744e43b0752fc877393b3a to your computer and use it in GitHub Desktop.
Asynchronous Webpack Configuration
...
// Build your configuration object, and then return a Promise
let finalConfig = {
devtool: 'eval',
output: { /* your configuration */ },
plugins: [ /* your configuration */ ]
};
module.exports = new Promise(resolve => {
getGitAndPackageInformation((gitAndPackageConfiguration) => {
// Add something to
finalConfig.plugins.unshift(new webpack.DefinePlugin({
__BUILD__: JSON.stringify(gitAndPackageConfiguration)
}));
resolve(finalConfig);
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment