Skip to content

Instantly share code, notes, and snippets.

@sota1235
Last active November 17, 2016 10:40
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 sota1235/dae20076fb76ccd70493e4dfd2335284 to your computer and use it in GitHub Desktop.
Save sota1235/dae20076fb76ccd70493e4dfd2335284 to your computer and use it in GitHub Desktop.
import proxyquire from 'proxyquire';
import Button from 'lib/button';
const Button = require('lib/button');
const MockButton = proxyquire('lib/button', {
'lib/functions/browser-dependencies': {
windowLocationHref: 'mock href',
},
}).default;
const button = new MockButton;
// export
export default class Button {
};
// import
import Button frmo 'button';
const Button = require('button'); // NG
const Button = require('button').default; // OK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment