The use of vue polyfill

require("es6-promise").polyfill()
import "babel-polyfill"
import "promise-polyfill/src/polyfill"
<script href="https://cdn.jsdelivr.net/npm/promise-polyfill@7/dist/polyfill.min.js"></script>

the first three lines of the above four lines of code are in the fourth line of main.js in vue.
I would like to ask about the role of these, which are introduced repeatedly. Beginners hope that God will give us some advice

.
May.24,2021

if you want to make your browser compatible with Es6, I know what you mean, because I have the same problem.

import 'babel-polyfill'
<script href="https://cdn.jsdelivr.net/npm/promise-polyfill@7/dist/polyfill.min.js"></script>

this is enough. I don't understand why you brought in cdn?. Don't you use npm for your vue project?


import 'babel-polyfill'

only this line is needed, and the other three lines are redundant. Delete, because babel-polyfill contains the es5 implementation of promise, and there is no need to introduce

repeatedly.
Menu