问题描述:

I'm really new to Webpack and I'm using axios with a React project. I installed axios via npm and then I'm importing it like so when I want to use it:

import axios from 'axios/dist/axios.min.js';

Webpack takes care of the rest. Is this the "right" way to do it?

网友答案:

I think the standard way of doing this is as follows:

import axios from 'axios';

The UMD build (axios.min.js) can be helpful when you need to include axios in a <script> tag:

<script src="https://npmcdn.com/axios/dist/axios.min.js"></script>
相关阅读:
Top