Navigation Menu

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

How can I inspect the packages while running examples? #1907

Closed
Nantris opened this issue Jun 15, 2018 · 6 comments
Closed

How can I inspect the packages while running examples? #1907

Nantris opened this issue Jun 15, 2018 · 6 comments
Labels

Comments

@Nantris
Copy link
Contributor

Nantris commented Jun 15, 2018

I'm running the examples using yarn run start and I'm trying to investigate how Slate and Slate-React handle things like setting selection, compositionEvents, etc. when using a mobile browser, but I am not able to inspect any of the relevant files. I'm not familiar with Lerna, so I'm not sure if that's related.

How can I view the files for Slate-React when inspecting the Rich Text example in the browser?

image

@Nantris
Copy link
Contributor Author

Nantris commented Jun 15, 2018

Okay here's what worked. First I disabled all the examples I wasn't using in ./examples/app.js

Then in the example I'm using, rich-text I changed this import:

From: import { Editor } from 'slate-react'
To: import { Editor } from '../../packages/slate-react/src'

@Nantris
Copy link
Contributor Author

Nantris commented Jun 15, 2018

I'm going to leave this open because I think we could use an easier way to enable this mode of development/inspection. Does anyone have an easy to implement idea for a switch that we could use for the entire repo? I have some half-baked ideas, but nothing fully coherent yet.

@Nantris
Copy link
Contributor Author

Nantris commented Jun 15, 2018

Ah scratch the above. This appeared to work until I actually tried to do anything, then I get:

image

Here's where things fail: https://github.com/ianstormtaylor/slate/blob/master/packages/slate-react/src/components/content.js#L437

At this stage the props look like this:
image

And inside of this.props.editor.props are the props that I assume are expected at the top level:

image

@ianstormtaylor
Copy link
Owner

It sounds like some just needs to investigate how the examples are built with Webpack, and what the required settings are in Webpack/Chrome to make sourcemaps work with the debugger?

@Nantris
Copy link
Contributor Author

Nantris commented Jun 18, 2018

The real issue is not the sourcemaps, as much as it is enabling use of the entire Slate monorepo as easily debuggable source code.

The sourcemap issue can probably be resolved with Babel@7.x, but what I can't figure out for the life of me is how to get the examples to use the unpackaged versions of packages like slate-react as opposed to the package from npm.

I'm pretty experienced with Webpack (which is to say, I've had some less than fun experiences), but this one I can't figure out. On the surface it would seem like my attempt to import the package's directly from source should work, but oh boy does it not work.

@justinweiss
Copy link
Collaborator

Just a note for anyone else taking a look at this:

If you yarn link packages/slate-react into the example, you should be able to get valid source maps, and have changes you make to slate-react take effect immediately (as long as you're also running yarn watch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants