Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble using Storybook with Sinon #223

Closed
ffxsam opened this issue Jun 1, 2016 · 2 comments
Closed

Trouble using Storybook with Sinon #223

ffxsam opened this issue Jun 1, 2016 · 2 comments

Comments

@ffxsam
Copy link

ffxsam commented Jun 1, 2016

import React from 'react';
import { storiesOf, action } from '@kadira/storybook';
import sinon from 'sinon';
import TrackBrowser from '../features/ReelBuilder/components/TrackBrowser';

const i18n = sinon.stub();

storiesOf('TrackBrowser', module)
  .add('no tracks', _ => <TrackBrowser open />);

I get the following warnings:

[HMR] bundle has warnings:
client.js?3ac5:104 [HMR] ./~/sinon/lib/sinon.js
Critical dependencies:
40:25-32 require function is used in a way in which dependencies cannot be statically extracted
 @ ./~/sinon/lib/sinon.js 40:25-32
client.js?3ac5:104 [HMR] ./~/sinon/lib/sinon/assert.js
Critical dependencies:
216:25-32 require function is used in a way in which dependencies cannot be statically extracted
 @ ./~/sinon/lib/sinon/assert.js 216:25-32
client.js?3ac5:104 [HMR] ./~/sinon/lib/sinon/behavior.js
Critical dependencies:
362:25-32 require function is used in a way in which dependencies cannot be statically extracted
 @ ./~/sinon/lib/sinon/behavior.js 362:25-32
client.js?3ac5:104 [HMR] ./~/sinon/lib/sinon/call.js
Critical dependencies:
230:25-32 require function is used in a way in which dependencies cannot be statically extracted
 @ ./~/sinon/lib/sinon/call.js 230:25-32

And the following red screen:

react_storybook

@thani-sh
Copy link
Contributor

thani-sh commented Jun 6, 2016

Seems like sinon and webpack don't work well together. I just checked some related issues ( sinonjs/sinon#830 webpack/webpack#304 ) and it seems we can avoid this error using a couple of methods:

use sinon v2
Update the package.json file to use sinon v2 (pre-release) which doesn't have this error. The downside is that there seems to be a few breaking changes between sinon v1 and sinon v2.

"sinon": "2.0.0-pre"

using noParse
A compiled version of sinon can also be used to avoid this issue. Please check this comment and a few comments below that.

@arunoda
Copy link
Member

arunoda commented Jun 13, 2016

I think this is not directly related to us and @mnmtanish pointed out some great ways to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants