Skip to content

Instantly share code, notes, and snippets.

@goldhand
Created March 30, 2017 01:13
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 goldhand/1f4bfa16ff5a66a9b936af03850939ff to your computer and use it in GitHub Desktop.
Save goldhand/1f4bfa16ff5a66a9b936af03850939ff to your computer and use it in GitHub Desktop.
Webpack - add asset to compilation
apply(compiler) {
compiler.plugin('after-emit', (compilation, callback) => {
const file = 'some data';
compilation.assets['foo.js'] = {
source: () => file,
size: () => Buffer.byteLength(file),
};
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment