Skip to content

Instantly share code, notes, and snippets.

@DefiantBidet
Last active September 2, 2015 15:18
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 DefiantBidet/d49cf4eee8b663eac9fb to your computer and use it in GitHub Desktop.
Save DefiantBidet/d49cf4eee8b663eac9fb to your computer and use it in GitHub Desktop.
getting sinon and fetch-mock to work with webpack.
// ...
module: {
loaders: [
// AMD Hacktory has naming collision. cease using AMD loader.
{
test: /sinon.*\.js$/,
loader: 'imports?define=>false',
},
// ...
],
noParse: [
/\/sinon.js/,
],
},
// ...
// http://webpack.github.io/docs/list-of-plugins.html
plugins: [
// ...
// sinon
new webpack.NormalModuleReplacementPlugin( /^sinon$/, path.resolve( __dirname, 'node_modules' , 'sinon/pkg/sinon.js' ) ),
// fetch-mock
new webpack.NormalModuleReplacementPlugin( /^fetch-mock$/, path.resolve( __dirname, 'node_modules' , 'fetch-mock/client.js' ) ),
// ...
],
// ...
@DefiantBidet
Copy link
Author

note: I've been writing a lot of ES6 and my linter config expects the last comma (i.e. lines 8 & 13). so bear that in mind if you've got different linter settings or using ES5.

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