carteb / carte-blanche

An isolated development space with integrated fuzz testing for your components. See them individually, explore them in different states and quickly and confidently develop them.
https://www.youtube.com/watch?v=6g3-TQ6aaw8
MIT License
1.5k stars 47 forks source link

Uncaught SyntaxError: Unexpected token u in JSON at position 0 #378

Closed necolas closed 6 years ago

necolas commented 7 years ago

I was looking into using storybook or carte-blanche to create a UI explorer for react-native-web. I followed the README instructions and added this to my webpack config:

new CarteBlanche({
  componentRoot: path.join(__dirname, '../src/components'),
  filter: /index.js$/
}),

But navigating to any example component produces this error:

Uncaught SyntaxError: Unexpected token u in JSON at position 0
mxstbr commented 7 years ago

Holy cow that's awesome! Do you have a repro somewhere so I can take a look at this specific bug?

(We don't have support for a non-editable mode at the moment, but if you give me a day I'll get that implemented!)

necolas commented 7 years ago

Oh, having the examples be editable is fine. It would be something used during development as much as for external consumption.

To repro:

  1. git clone react-native-web
  2. npm install carte-blanche
  3. Add that code block to examples/webpack.config.js
  4. npm run examples
mxstbr commented 7 years ago

Will take a look tomorrow!

LeZuse commented 7 years ago

Also encountered this one. I made a workaround by fixing https://github.com/carteb/carte-blanche/blob/0cedc40b10b788508a255dc9d854c517c68ce24f/plugins/react/frontend/index.js#L24 with this:

basePath={JSON.parse(pluginData && pluginData.basePath || '{}')}

But the the root cause is probably deeper than that.

nikgraf commented 7 years ago

Just tried, I even get an earlier error … need to take a closer look at another time.

screen shot 2016-07-17 at 08 51 59
nikgraf commented 7 years ago

@LeZuse do you have an example repo?

LeZuse commented 7 years ago

@nikgraf I will try to make an isolated repro and will get back to you.

thebuilder commented 7 years ago

@nikgraf I'm getting the same error - Seem to fail while parsing the Component data:

It's calling http://localhost:8082/variations/src/components/Footer/Footer.js, which returns:

{"data":{}}