eslint-plugin

@masknet/prefer-defer-import

Prefer defer import a module. See https://github.com/tc39/proposal-defer-import-eval and https://github.com/webpack/webpack/pull/16567/.

Rule Details

Options

/**
 * @minItems Infinity
 */
export type Options = [
  | {
      /**
       * @minItems 0
       */
      deferPackages?: string[]
      syntax?: 'webpack-magic-comment'
    }
  | {
      /**
       * @minItems 0
       */
      eagerPackages?: string[]
      syntax?: 'webpack-magic-comment'
    },
]

:x: Incorrect

import { foo } from 'bar'
foo

:white_check_mark: Correct

import * as foo from /* webpackDefer: true */ 'bar'
foo.foo

Attributes