我有一个reactjs npm 包,我想将它包含在 html 文件中,我在这里得到了捆绑文件,但我面临一个require不是函数的问题,因为我不在 nodejs 项目中。所以我无法导入其他依赖项,有人可以进一步帮助我吗?
console.log(window.React, 'AAB');
window.ReactDOM.render(window.React.createElement(window.ListItem, {
labelOption: 'name',
typeOption: 'type',
valueOption: 'k',
onRemoveItem: (e) => {console.log('1')},
item: {name: 'Zeyad', type: 'person'}
}, 'Hi'), document.getElementById("app"));
<!DOCTYPE html>
<html>
<head>
<title>Parcel Sandbox</title>
<meta charset="UTF-8" />
<link href="https://unpkg.com/react-multiple-selector@1.0.7/dist/styles.css">
</head>
<body>
Name:
<div id="app"></div>
<script>
var exports = {};
</script>
<script
crossorigin
src="https://unpkg.com/react@16/umd/react.production.min.js"></script>
<script
crossorigin
src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"
></script>
<script src="https://unpkg.com/react-multiple-selector@1.0.7/dist/index.js"></script>
<script src="https://unpkg.com/react-multiple-selector@1.0.7/dist/ListItem.js"></script>
<script src="https://unpkg.com/react-multiple-selector@1.0.7/dist/data.js"></script>
<script src="https://gist.githubusercontent.com/gaearon/0b180827c190fe4fd98b4c7f570ea4a8/raw/b9157ce933c79a4559d2aa9ff3372668cce48de7/LikeButton.js"></script>
</body>
</html>
拉丁的传说
缥缈止盈
跃然一笑
相关分类