Last active
September 21, 2017 03:40
-
-
Save third774/db6c7e8cf07cce0ac0fc42c9f88b4cbc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
// 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