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

renderToJson broken in 3.2.5 #519

Open
Esorakouki opened this issue Jun 7, 2020 · 4 comments
Open

renderToJson broken in 3.2.5 #519

Esorakouki opened this issue Jun 7, 2020 · 4 comments

Comments

@Esorakouki
Copy link

Expected behavior:

Observed behavior: when I update the version from 3.1.2 to 3.2.5 , report error "undefined is not an object (evaluating 'bridge.createStringMeasurer') "

How to reproduce:
image
image

Sketch version: 66

But it work when i change the import:
image
May be related to this pr #517

@macintoshhelper
Copy link
Contributor

Does render work as normal, but renderToJSON not work? import ... from 'react-sketchapp' should be resolving to react-sketchapp/lib/module/entrypoint.sketch. Have you tried it in a fresh project?

@mathieudutour
Copy link
Collaborator

mathieudutour commented Jun 8, 2020

Are you building with skpm? If so, what's the version? If it's not the latest, try updating.
If not, you need to configure webpack to pick .sketch.js before .js

@macintoshhelper
Copy link
Contributor

I tested in a fresh project with skpm create my-app --template=airbnb/react-sketchapp ([email protected]) and couldn't reproduce this, so seems to be an issue with local setup.

import { render, renderToJSON, Artboard, Text, View } from 'react-sketchapp';

console.log(renderToJSON(<Document colors={colorList} />))

Are you building with Babel before building/rendering with skpm? Might want to mark react-sketchapp as an external dependency during build, or just use skpm build with a custom Babel config.

@Esorakouki
Copy link
Author

@mathieudutour @macintoshhelper My sketch crashed when I run a new project with template or run examples in react-sketchapp, so may be related to my local environment. I will test in other computer and try update skpm in my project later.

And I wonder if there is any doc about skpm entry point configuration? thanks!

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