azl397985856 / fe-interview

宇宙最强的前端面试指南 (https://lucifer.ren/fe-interview)
Apache License 2.0
2.83k stars 260 forks source link

【每日一题】- 2020-04-22 - webpack的动态加载是如何做到的? #116

Closed azl397985856 closed 4 years ago

azl397985856 commented 4 years ago

如下代码。 webpack 是怎么打包的? 打包之后会生成什么样的bundle? 运行时又是怎么调度的?

src
---main.js
---moduleA.js
---moduleB.js

/**
* moduleA.js
*/
export default function testA() {
    console.log('this is A');
}

/**
* main.js
*/
import testA from './moduleA';

testA();

import('./moduleB').then(module => {

})
stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.