示例工程 16-mini-bundler

16-mini-bundler/01-mini-bundler/index.html

html · 0.6 KB

运行:16 · 迷你 bundler

点击「运行示例」后,左侧显示源码、右侧显示运行结果;console 输出会实时回传。

<!doctype html>
<html lang="zh-CN">
<head>
  <meta charset="utf-8">
  <title>16 · 迷你 bundler</title>
</head>
<body>
  <p>产物 <code>dist/bundle.js</code> 由迷你 bundler 生成,直接被本页引入。</p>
  <pre id="output"></pre>
 
  <script src="./dist/bundle.js"></script>
  <script>
    const result = window.__miniBundle.run();
    console.log('bundle.run() =>', JSON.stringify(result, null, 2));
    document.getElementById('output').textContent = JSON.stringify(result, null, 2);
  </script>
 
  <script type="module">
    import { run } from './main.js';
    run();
  </script>
</body>
</html>