Babel-polyfill error, only one instance of babel-polyfill is allowed


clipboard.png

main.js

clipboard.png

webpack.base.conf.js

clipboard.png

in

package.json

seek God"s solution, Google has not found a suitable solution for a long time

Mar.04,2021

recently built the react development environment, also encountered this problem. My problem was just a warning on the console, and after several days of entanglement, it was finally solved

see a reply on stackoverflow that it may be a problem with the plug-in HtmlWebpackPlugin . HtmlWebpackPlugin will generate the html template, and then dynamically insert the js in memory into the template file. I suddenly remembered that I manually added such a sentence < script src= "/ app.js" > < / script > to the template. I hastened to check the source code. Sure enough, it loaded app.js

twice.

obviously the reason has been told to you. You can only introduce babel-polyfill
once and then you introduce it twice to delete the relevant code in main.js.

in addition, the polyfill,es6-promise of babel-polyfill containing Promise is redundant here


did you solve it this way? Why is it still blank in the low version of Android after I introduced it? I only did two things: install it through npm install babel-polyfill-save, and then add the configuration entry: {app: ['babel-polyfill','. / src/main.js']} to webpack.base.conf.js. The compilation and packaging did not report an error, but it was still blank under Android. Where could it be?

Menu