hadfieldn / storybook-filepath-chapters

React Storybook loader that uses storybook-chapters to create hierarchical navigation that mirrors the filesystem
7 stars 4 forks source link

book.chapter is not a function #2

Open mzedeler opened 7 years ago

mzedeler commented 7 years ago

I'm getting this error:

book.chapter is not a function
TypeError: book.chapter is not a function
    at eval (webpack:///./~/storybook-filepath-chapters/lib/loader.js?:138:18)
    at Array.forEach (native)
    at eval (webpack:///./~/storybook-filepath-chapters/lib/loader.js?:123:22)
    at Array.forEach (native)
    at eval (webpack:///./~/storybook-filepath-chapters/lib/loader.js?:121:23)
    at ConfigApi._renderMain (webpack:///./~/storybook-filepath-chapters/~/@kadira/storybook/dist/client/preview/config_api.js?:40:20)
    at render (webpack:///./~/storybook-filepath-chapters/~/@kadira/storybook/dist/client/preview/config_api.js?:66:17)
    at ConfigApi.configure (webpack:///./~/storybook-filepath-chapters/~/@kadira/storybook/dist/client/preview/config_api.js?:91:9)
    at loadStorybook (webpack:///./~/storybook-filepath-chapters/lib/loader.js?:223:28)
    at eval (webpack:///./app/components/.storybook/config.js?:64:59)

This is my storybook config:

import { configure, addDecorator } from '@kadira/storybook';
import { loadStorybook } from 'storybook-filepath-chapters';
import React from 'react';

const req = require.context('../', true, /\.stories\.jsx$/);

configure(() => loadStorybook('Main', req), module);

Any hints what causes this? It seems that the underlying storybook-chapters module hasn't been loaded correctly, but I assume this isn't something I need to handle?

hadfieldn commented 7 years ago

Hmm. You shouldn't have to, but what happens if you do add storybook-chapters to your project?

mzedeler commented 7 years ago

Well - I tried and it didn't help.

Here is what happens when I just install storybook-filepath-chapters:

 $ npm install
my-project@1.0.0 /home/mike/my-project
└─┬ storybook-filepath-chapters@1.4.0 
  ├─┬ @kadira/storybook@2.35.3 
  │ ├── postcss-loader@1.1.0 
  │ └── uuid@2.0.3 
  └─┬ storybook-chapters@0.1.1 
    └── storybook-adk@0.7.6 

I'm running node v6.10.3.

I tried to debug the issue by switching on logging and outputting the book object.

It has the following properties:

add
addDecorator
kind

Where add and kind are methods and kind is a title of some kind.

It seems that storybook-chapters isn't being loaded as it should.