Skip to content

Instantly share code, notes, and snippets.

@nkbt
Created January 7, 2015 06:14
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 nkbt/94fa5e77739ecfdf4a61 to your computer and use it in GitHub Desktop.
Save nkbt/94fa5e77739ecfdf4a61 to your computer and use it in GitHub Desktop.
Simple way to load legacy dependency with Webpack for tests
/*
Example of legacy lib
./legacy_lib.js
*/
App = App || {};
App.Tool = function () {
};
/*
./legacy_lib_spec.js
*/
// ...
var AppMock = {};
var Tool = require('inject!' +
'imports?App=AppMock!' +
'exports?App.Tool!' +
'./legacy_lib'
)({'AppMock': AppMock});
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment