You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Managing bundle sizes and enforcing code-splitting in large applications can be delicate, and there is currently no mechanism which I know of to enforce that specific libraries must not be imported with ordinary import moment from 'moment'; syntax, and instead must be split like const momentPromise = import('moment').
This already exists overall: no-restricted-imports and no-restricted-modules.
I’d say the import rule could perhaps have an extra config option that indicates whether it’s redtricted for sync, async, or both.
However, both of those are core rules (not in this plugin), import() is stage 3, eslint only supports stage 4 and above, and i don’t think it’d make sense to add an entire rule here when it’d be a simple option in the future in core.
Managing bundle sizes and enforcing code-splitting in large applications can be delicate, and there is currently no mechanism which I know of to enforce that specific libraries must not be imported with ordinary
import moment from 'moment';
syntax, and instead must be split likeconst momentPromise = import('moment')
.Proposed API:
Example No. 1, errors:
Example No. 2, errors:
Example No. 3, passes
Would there be an appetite for this? If there would be, I would consider making a PR of my own.
The text was updated successfully, but these errors were encountered: