Skip to content

Instantly share code, notes, and snippets.

@rich-97
Created August 20, 2017 06:49
Show Gist options
  • Save rich-97/87ee0e40b94821355509c9bff33bc255 to your computer and use it in GitHub Desktop.
Save rich-97/87ee0e40b94821355509c9bff33bc255 to your computer and use it in GitHub Desktop.
Liltle snippets for webpack export single object.
module.exports = {}
// Resolve the problem with the context (is by webpack).
Object.keys(module.exports).forEach(function (key) {
if (typeof module.exports[key] === 'function') {
module.exports[key] = module.exports[key].bind(module.exports)
}
})
@rich-97
Copy link
Author

rich-97 commented Aug 20, 2017

The context between methods isn't work properly, this bug is in webpack 2.3.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment