Skip to content

Instantly share code, notes, and snippets.

@billyjanitsch
Last active February 29, 2016 17:57
Show Gist options
  • Save billyjanitsch/7f727bb217a6b233af4b to your computer and use it in GitHub Desktop.
Save billyjanitsch/7f727bb217a6b233af4b to your computer and use it in GitHub Desktop.
Custom register hook
// transform all imports with Babel
require('babel-core/register')
// include the environment polyfill
require('babel-polyfill')
// return empty objects for CSS imports
require.extensions['.scss'] = () => null
require.extensions['.css'] = () => null
// return empty strings for image imports
const emptyString = module => {
module.exports = ''
}
require.extensions['.svg'] = emptyString
require.extensions['.png'] = emptyString
// hijack console.error to throw
console.error = error => {
throw new Error(error)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment