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

Show how to skip imports for optional plugins #2627

Merged
merged 2 commits into from Jan 3, 2019

Conversation

chris-morgan
Copy link
Contributor

The most common Rollup plugins are pretty fast to import (by Node standards), but even those will commonly add on a handful of milliseconds, and it’s not unheard of to have imports literally take seconds. If you don’t need it, why load it? I think that this is a good pattern to recommend.

eslint and stylelint are two good examples of unreasonably slow modules that will commonly be optional. stylelint can take a second or two, and eslint a few hundred milliseconds, because neither of them care enough about startup time. stylelint/stylelint#2454 was me reporting it for stylelint. I wish more people used Rollup on their packages before submitting them to npm.

chris-morgan and others added 2 commits January 3, 2019 15:10
The most common Rollup plugins are pretty fast to import (by Node
standards), but even those will commonly add on a handful of
milliseconds, and it’s not unheard of to have imports literally take
seconds. If you don’t need it, why load it? I think that this is a good
pattern to recommend.

eslint and stylelint are two good examples of unreasonably slow modules
that will commonly be optional. stylelint can take a second or two, and
eslint a few hundred milliseconds, because neither of them care enough
about startup time. stylelint/stylelint#2454
was me reporting it for stylelint. I wish more people used Rollup on
their packages before submitting them to npm.
Copy link
Member

@lukastaegert lukastaegert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I like the technique!

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

Successfully merging this pull request may close these issues.

None yet

2 participants