carteb/carte-blanche

Uncaught SyntaxError: Unexpected token u in JSON at position 0

necolas opened this issue · 8 comments

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

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!)

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

Will take a look tomorrow!

Also encountered this one. I made a workaround by fixing

basePath={JSON.parse(pluginData.basePath)}
with this:

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

But the the root cause is probably deeper than that.

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

@LeZuse do you have an example repo?

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

@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":{}}