Reputation: 35864
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?
Upvotes: 5
Views: 16653
Reputation: 25907
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>
Upvotes: 16