-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Prevent edit-post from being loaded in edit-site #45895
Conversation
Open in CodeSandbox Web Editor | VS Code | VS Code Insiders |
Size Change: +13.5 kB (+1%) Total Size: 1.31 MB
ℹ️ View Unchanged
|
Thanks for working on this. I had been looking for the source of this but you found it faster. I get this error when I open the site editor:
Also, please can you explain why it's OK for the native files to load this dependency but not the web editor? Thanks again! |
Native files have their own build scripts... I think they probably bundle everything into a single script but to be honest it's a bit out of my expertise. I think conceptually, the issue is the same there though.
yeah good catch, I'll fix it later. |
Fixed the JS error @scruffian I'm still seeing some errors on the site editor myself but I'm also seeing them on trunk (and might be something that is only showing up for me) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I don't see any errors in the site editor.
What?
I noticed that when loading the site editor, the edit-post script was also being loaded there. This loads useless kbytes into the site editor and might have some unexpected consequences (like running side effects in the edit-post script).
How?
The problem was that the block-directory package has a plugin that is specific to edit-post but it was importing the package directly causing a wp dependency to be added to the script. This PR uses the global variable directly and also adds some lint rules to prevent top level packages from being imported in other packages.
Note that there are some remaining imports in "native" files, I preferred to leave these untouched for now, folks from the mobile team might know better what's the best approach there.
Testing Instructions
1- load the site editor
2- Ensure that the edit-post script is not loaded.