【发布时间】:2019-05-03 18:35:08
【问题描述】:
根据项目经理的要求,我不能将它与 npm 捆绑,所以我坚持使用每个库的 CDN 版本。
到目前为止,一切都运行良好,React、Material-UI、React-Select 和 Babel。
但尝试包含 Async.js (https://unpkg.com/react-select/lib/Async.js) 给了我Uncaught ReferenceError: exports is not defined
我看到在https://unpkg.com/react-select/dist/react-select.js 中有对Async 和AsyncSelect 的引用,但我不知道如何使用AsyncSelect 组件,如https://react-select.com/async 所示
这就是我使用库的方式:
<script src="https://unpkg.com/react@16.7.0/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16.7.0/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/babel-standalone@6/babel.js"></script>
<script src="https://unpkg.com/@material-ui/core/umd/material-ui.development.js"></script>
<script src="https://unpkg.com/react-select@2.1.2/dist/react-select.js"></script>
<!-- ... and other dependencies -->
【问题讨论】:
标签: javascript reactjs react-select