question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Tree-Shaking" support for TipTap

See original GitHub issue

It look like “tiptap-extensions” is load all extensions even i did not use all of them.

import {
    BlockquoteNode,
    BulletListNode,
    HardBreakNode,
    HeadingNode,
    ImageNode,
    ListItemNode,
    OrderedListNode,
    BoldMark,
    ItalicMark,
    HistoryExtension,
  } from 'tiptap-extensions'

I use only these extensions but in my vendor file, there is “highlight.js” dependency.

It would be nice if we can import only what we use.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:17 (13 by maintainers)

github_iconTop GitHub Comments

6reactions
dannyrbcommented, Sep 6, 2018

I mean, you don’t tree shake, you just “support” tree shaking. An example would be… WebPack goes to bundle your code, and it places comments around the modules that weren’t used. Usually putting a comment before the unused module like:

/* unused harmony export <export name> */

Then a minifier, like uglify, removes the unused code during the minification process. You can read a bit more on it here: https://webpack.js.org/guides/tree-shaking/

See the requirements section:

  • Use ES2015 module syntax (i.e. import and export).
  • Add a “sideEffects” property to your project’s package.json file.
  • Use production mode configuration option to enable various optimizations including minification and tree shaking.
3reactions
TheLarkInncommented, Sep 11, 2018

I would have user confirm their Babel setup. Also a relevant article:

https://stackoverflow.com/questions/49160752/what-does-webpack-4-expect-from-a-package-with-sideeffects-false

On Sun, Sep 9, 2018, 1:26 PM Philipp Kühn notifications@github.com wrote:

Another solution I think about is to move all extension to its own package.

import BlockquoteNode from 'tiptap-bockquote-extension’import BulletListNode from 'tiptap-bulletlist-extension’import HardBreakNode from 'tiptap-hardbreak-extension’import HeadingNode from ‘tiptap-heading-extension’// …

That would solve this issue too but I’m not sure if this is »too much«!? 🤔

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/heyscrumpy/tiptap/issues/16#issuecomment-419742615, or mute the thread https://github.com/notifications/unsubscribe-auth/ADQBMPLK-MoiYlKaPMN3fFc9RX45BoCSks5uZXl4gaJpZM4WdNFA .

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Tree-Shaking" support for TipTap · Issue #16 - GitHub
It look like "tiptap-extensions" is load all extensions even i did not use all of them. import { BlockquoteNode, BulletListNode, ...
Read more >
Migration from tiptap v.1 to tiptap v.2 - DEV Community ‍ ‍
I hope this guide will help you do the migration and if you have any questions feel free to ask. Top comments (0) ......
Read more >
How are you guys keep package sizes down? : r/vuejs - Reddit
In particular, the tree shaking and dynamic imports. But my package sizes are still ... I suspect maybe tiptap or beufy? My package...
Read more >
Configuration – Tiptap Editor
Configure the editor​​ This will do the following: bind Tiptap to . element , load the Document , Paragraph and Text extensions,
Read more >
Tree Shaking - webpack
Tree shaking is a term commonly used in the JavaScript context for dead-code elimination. It relies on the static structure of ES2015 module...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found