// index.js 入口文件console.log("index.js 被加载了");// 直接引入,不是懒加载// import { mul } from './test';// 给DOM绑定事件,触发事件后执行 js 方法document.getElementById('btn').onclick = function () {// 懒加载: 当文件使用到才会加载// 预加载 prefetch : 会在使用前,提前加载JS文件// 正常加载 是认为是并行加载 (同一时间加载多个文件)// 预加载 perfecth: 等其他资源加载完毕,浏览器空闲了,在偷偷加载资源import('./test').then(({mul}) => { console.log(mul(4, 6))});// 懒加载也会自动分割为一个单独的文件}
// test.jsfunction mul (x, y) {console.log(x * y)}export defalut mul;
