【发布时间】:2020-05-07 21:49:07
【问题描述】:
使用 Rollupjs,我尝试在我的 index.html 页面上运行我的模块
<script type="module" src="./bundle.js" ></script>
<script>
window.addEventListener('load', () => {
const lib = new MyLibrary();
console.log(lib);
});
</script>
我收到以下错误:
(index):17 Uncaught ReferenceError: MyLibrary is not defined
模块格式为UMD。谢谢!
【问题讨论】:
-
<script type="module">对于 UMD 模块没有意义。
标签: javascript undefined onload umd