示例工程 17-tree-shaking-splitting-hmr

17-tree-shaking-splitting-hmr/01-side-effects/index.html

html · 0.5 KB

运行:17 · 副作用与 tree-shaking

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

<!doctype html>
<html lang="zh-CN">
<head>
  <meta charset="utf-8">
  <title>17 · 副作用与 tree-shaking</title>
</head>
<body>
  <p>打开 Console 查看「未使用导出」与「顶层副作用」的区别。</p>
  <script type="module">
    import { run, effectRuns } from './main.js';
    run();
    console.log('再次动态导入 effect.js 不会重复执行 =>', (await import('./effect.js')).effectValue, effectRuns());
  </script>
</body>
</html>