Skip to content

Instantly share code, notes, and snippets.

@third774
Last active September 21, 2017 03:40
Show Gist options
  • Save third774/db6c7e8cf07cce0ac0fc42c9f88b4cbc to your computer and use it in GitHub Desktop.
Save third774/db6c7e8cf07cce0ac0fc42c9f88b4cbc to your computer and use it in GitHub Desktop.
/*
// file should be in ${workspaceRoot}/loaders/
const path = require('path');
webpackConfig = {
resolveLoader: {
modules: [
'node_modules',
path.resolve(__dirname, 'loaders')
]
},
...restOfConfig
}
*/
module.exports = function(source, map) {
const wrappedModule = `
try {
${source}
} catch (error) {
console.warn(error);
}
`
this.callback(null, wrappedModule, map);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment