Last active
September 2, 2015 15:18
-
-
Save DefiantBidet/d49cf4eee8b663eac9fb to your computer and use it in GitHub Desktop.
getting sinon and fetch-mock to work with webpack.
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
// ... | |
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' ) ), | |
// ... | |
], | |
// ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.