You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
818 B
HTML
28 lines
818 B
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta
|
|
name="viewport"
|
|
content="width=device-width, initial-scale=1.0"
|
|
/>
|
|
<title>将多个有依赖关系的js文件打包为一个js</title>
|
|
</head>
|
|
<body></body>
|
|
<script type="module">
|
|
// 导入 Module 类
|
|
// import Module from './module/index.js';
|
|
import Module from './webpack_dist/index.js';
|
|
|
|
// 使用 Module
|
|
const myModule = new Module();
|
|
console.log(myModule.modules); // 输出 [A, B]
|
|
|
|
// 调用 A 模块的 log 方法
|
|
myModule.modules[0].log(); // 输出 "Hello from A module"
|
|
|
|
// 调用 B 模块的 log 方法
|
|
myModule.modules[1].log(); // 输出 "Hello from B module"
|
|
</script>
|
|
</html>
|