Feature Request: Add "sideEffects": false to packages #6985
majellin24
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description
I see that "sideEffects": false is set for the core, extension-floating-menu and extension-bubble-menu packages but not any of the other feature packages (extension-bold, extension-heading, etc). This means that these extensions do not get tree shaken properly if they are imported into parts of the code which themselves get tree shaken.
In my case, I am using tiptap with angular, and I define a module with various directives for features like Bold. The consumer of this module might use some of the directives but chose not to use others. Without "sideEffects": false, all the extensions get added to the bundle whether they are used or not. It would be ideal to only have the used extensions added. For example, I have tested this in a project which imports my module, and only uses my heading directive. I can see in the bundle that the extension-bold code is still present, even though the project did not use the bold directive, and the code for the bold directive was tree shaken away. If I simply modify the extension-bold package.json in my node_modules folder to have "sideEffects": false, I see that the extension-bold code is indeed tree shaken away.
I guess my question is, do these other extension packages indeed have side effects, or could you simply add "sideEffects": false to their package.json files to improve tree shaking for libraries which use them?
I did find this issue: #16 but to my reading this may have been before each extension had its own package?
Sorry if I missed something.
Use Case
I would like to create an angular module which has directives for adding support for each extension individually, so that a consumer can pick and choose which extensions to use and have the rest get tree shaken out of the bundle.
Type
New feature
Beta Was this translation helpful? Give feedback.
All reactions