Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我真的是 Webpack 的新手,我正在使用 axios 和一个 React 项目。我通过 npm 安装了 axios,然后在我想使用它时像这样导入它:
import axios from 'axios/dist/axios.min.js';
Webpack 负责其余的工作。这是“正确”的做法吗?
我认为这样做的标准方法如下:
import axios from 'axios';
当您需要在标签中包含 axios 时,UMD 构建 (axios.min.js) 会很有帮助<script>:
<script>
<script src="https://npmcdn.com/axios/dist/axios.min.js"></script>