懒加载

使用import()方法实现懒加载,webpack会把import()引入的模块单独打包成一个chunk,调用的时候才会引入

setTimeout(() => {
  import('./math.js')
    .then(res => {
      console.log(res.default)
    })
}, 3000)

results matching ""

    No results matching ""