Open
Description
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')
.
Proposed API:
"rules": {
"import/no-synchronous-dependencies": ["error", {
"packages": ['moment', 'zxcvbn']
}]
}
Example No. 1, errors:
import moment from 'moment'
Example No. 2, errors:
const moment = require('moment')
Example No. 3, passes
const momentLoader = import('moment')
Would there be an appetite for this? If there would be, I would consider making a PR of my own.