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

Move isHTMLElement into core #4977

Merged
merged 1 commit into from
Sep 8, 2023
Merged

Move isHTMLElement into core #4977

merged 1 commit into from
Sep 8, 2023

Conversation

zurfyx
Copy link
Member

@zurfyx zurfyx commented Sep 7, 2023

Adding this dependency onto core adds another 6.9K to core unnecessarily. Since it's just a couple very lightweight functions I'm moving them into core for now while retaining the export onto @lexical/utils for backward compatibility.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 7, 2023
@vercel
Copy link

vercel bot commented Sep 7, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
lexical ✅ Ready (Inspect) Visit Preview Sep 7, 2023 2:46pm
lexical-playground ✅ Ready (Inspect) Visit Preview Sep 7, 2023 2:46pm

@github-actions
Copy link

github-actions bot commented Sep 7, 2023

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
packages/lexical/dist/Lexical.js 28.03 KB (-22.95% 🔽) 561 ms (-22.95% 🔽) 79 ms (-33% 🔽) 640 ms
packages/lexical-rich-text/dist/LexicalRichText.js 39.21 KB (+0.04% 🔺) 785 ms (+0.04% 🔺) 77 ms (-43.54% 🔽) 861 ms
packages/lexical-plain-text/dist/LexicalPlainText.js 39.18 KB (+0.04% 🔺) 784 ms (+0.04% 🔺) 80 ms (+14.35% 🔺) 864 ms

@acywatson
Copy link
Contributor

Adding this dependency onto core adds another 6.9K to core unnecessarily

If this is true, then our tree-shaking is broken. There's no reason why we should be bundling the entire utils package into the core because of two imports. I don't mind if we do this but I want to:

  1. verify that we've checked that this actually reduces core bundle size (not sure if I trust the above size limit checker).

  2. understand why tree-shaking is not working in this scenario, as this impacts every other package we bundle.

@acywatson
Copy link
Contributor

Actually two more thoughts:

  1. the core should probably stay dependency-free anyway

  2. could the tree-shaking issue have to do with not specifying @lexical/utils as a dependency in the lexical core package.json?

@zurfyx
Copy link
Member Author

zurfyx commented Sep 7, 2023

Adding this dependency onto core adds another 6.9K to core unnecessarily

If this is true, then our tree-shaking is broken. There's no reason why we should be bundling the entire utils package into the core because of two imports. I don't mind if we do this but I want to:

  1. verify that we've checked that this actually reduces core bundle size (not sure if I trust the above size limit checker).
  2. understand why tree-shaking is not working in this scenario, as this impacts every other package we bundle.

@acywatson I'm not sure tree-shaking will work on a per-file basis (not what I've seen so far) but internally this is not ideal, see https://fburl.com/diff/o2jlrdx2

@acywatson
Copy link
Contributor

Adding this dependency onto core adds another 6.9K to core unnecessarily

If this is true, then our tree-shaking is broken. There's no reason why we should be bundling the entire utils package into the core because of two imports. I don't mind if we do this but I want to:

  1. verify that we've checked that this actually reduces core bundle size (not sure if I trust the above size limit checker).
  2. understand why tree-shaking is not working in this scenario, as this impacts every other package we bundle.

@acywatson I'm not sure tree-shaking will work on a per-file basis (not what I've seen so far) but internally this is not ideal, see https://fburl.com/diff/o2jlrdx2

Tree-shaking is concerned with modules and their specific exports/imports, so it should definitely work on a per-file basis. Let's discuss offline.

@zurfyx zurfyx merged commit 16970c8 into main Sep 8, 2023
@zurfyx zurfyx deleted the utilexport branch September 8, 2023 20:44
zurfyx added a commit that referenced this pull request Sep 8, 2023
@zurfyx zurfyx mentioned this pull request Sep 8, 2023
@ajax-fam-d
Copy link

Hi, after this pr LexicalRichText is failing utils.isHTMLElement is not a function HeadingNode.exportDOM

@valdemarua
Copy link

@ajax-fam-d most likely you haven't updated all @lexical packages to the latest 0.12.2 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants