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

Question: what is "module" the second argument of storiesOf? #2022

Closed
elisechant opened this issue Oct 11, 2017 · 5 comments
Closed

Question: what is "module" the second argument of storiesOf? #2022

elisechant opened this issue Oct 11, 2017 · 5 comments

Comments

@elisechant
Copy link

For this code, what is module? and what can you do with it?

storiesOf('Button', module)
  .add('with text', () => (
    <Button onClick={action('clicked')}>Hello Button</Button>
  ))
@elisechant
Copy link
Author

A colleague at my workplace has suggested that module relates to the ES5 export syntax module.exports.

@ndelangen
Copy link
Member

ndelangen commented Oct 12, 2017

that's indeed it @elisechant !

Storybook needs a reference to the file/module where your story-code is int to enable hpt-module-replacement.

If you do not supply it, you'd need to refresh your browser for every change you make to your component & story code.

I hope this helps!
(please re-open if your have further questions)

@melenaos
Copy link

melenaos commented Jan 5, 2019

How we overcome the ESLint error that 'module' is not defined?

@ndelangen
Copy link
Member

https://eslint.org/docs/user-guide/configuring#specifying-environments

You tell eslint that the code will run in node and it should recognised that module exists.

alternatively this is a solution too:
https://stackoverflow.com/questions/39053562/eslint-no-undef-and-webpack-plugin

@Lelith
Copy link

Lelith commented Jan 14, 2019

thanks @ndelangen

adding following to my eslintrc file worked for me

"env": {
    "browser": true,
    "node": true
  }

bryanstearns added a commit to infinitered/ignite-bowser that referenced this issue Jan 26, 2019
The Storybook fix for this issue storybookjs/storybook#1525
adds a warning when `storiesOf` doesn’t have a `module` parameter.

The `module` parameter is necessary to enable hot-module-replacement to work right:
storybookjs/storybook#2022 (comment)
jamonholmgren pushed a commit to infinitered/ignite-bowser that referenced this issue Mar 11, 2019
The Storybook fix for this issue storybookjs/storybook#1525
adds a warning when `storiesOf` doesn’t have a `module` parameter.

The `module` parameter is necessary to enable hot-module-replacement to work right:
storybookjs/storybook#2022 (comment)

[skip ci]
infinitered-circleci pushed a commit to infinitered/ignite-bowser that referenced this issue Apr 9, 2019
# [3.1.0](v3.0.0...v3.1.0) (2019-04-09)

### Bug Fixes

* **boilerplate:** Remove double slash typo on setup-root-store.ts ([#160](#160) by [@dashracer](https://github.com/dashracer)) ([941a1fe](941a1fe))
* **tests:** Quell storybook HMR warnings ([#149](#149) by [@bryanstearns](https://github.com/bryanstearns)) ([5663289](5663289)), closes [/github.com/storybookjs/storybook/issues/2022#issuecomment-336027878](https://github.com//github.com/storybooks/storybook/issues/2022/issues/issuecomment-336027878)
* **typescript:** TypeScript should apply to `app` instead of `src` ([#167](#167) by [@guhungry](https://github.com/guhungry)) ([b737f08](b737f08))

### Features

* **i18n:** Migrate to react-native-localize ([#165](#165) by [@guhungry](https://github.com/guhungry)) ([2c73ff4](2c73ff4))
* **mobx:** Update to mobx-state-tree version 3.12.2 ([#166](#166) by [@guhungry](https://github.com/guhungry)) ([7911213](7911213))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants