JSPM

lazyload-loader

1.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 9
  • Score
    100M100P100Q31533F
  • License MIT

react lazy loader

Package Exports

  • lazyload-loader

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (lazyload-loader) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

lazyload-loader

按照路由分割的方式实现懒加载

用法:

 npm install --save-dev lazyload-loader

webpack配置


 module: {
    rules: [
      {
        test: /\.(js|jsx)$/,
        use: [
          'babel-loader',
          'lazyload-loader',
        ]
      },
    ···
  },

Router 的配置

// 使用lazy! 作为前缀
import Shop from 'lazy!./view/Shop';

// Route 正常使用
 <Route path="/shop" component={Shop} />

License

The MIT License