Use the screenfull plug-in to report an error error in ./node_modules/screenfull/index.js solution

npm install --save screenfull, using the installation screenfull dependency error error in ./node_modules/screenfull/index.js

1. Error message

The error message after installation is as follows:

It is said that the webpack .confing file does not support the syntax problem of the latest version; 

Two, the solution

1. Introduce low version library

Because the version installed directly by install is ^6.0.1, after checking the information on the Internet, it is said that the version is too high, and the version needs to be reduced. With the mentality of giving it a try, I chose to reduce the version to 5.*

npm i [email protected]

2. Start the service again

I thought it was going to start successfully, but it failed again, so why is it reporting an error? I found that the path we imported is screenfull in the module directory, but there is no corresponding index.js file at all

So we have to change the import path:

import screenfull from "screenfull/dist/screenfull";

 The page is displayed normally, and the full screen function is also normal, happy~~~~

Guess you like

Origin blog.csdn.net/qq_37485170/article/details/130622652