How to Solve screenfull plug-in Error (Version Issues)

We can use handwriting directly to realize the full screen function, but it is very convenient to use the screenfull plug-in to deal with the problem of full screen, but there is a bug in normal use today

Install NPM package NPM i screenfull ,the default is to import the latest version

Import Import screenfull from 'screenfull' to use

You can use the full screen function nomarlly screenfull.toggle()

At this time, I reported an error to me


when the page was blank and could not be loaded, I went to the Internet to find several articles that said the version was too high and needed to reduce the version of the package plug-in. I tried many times and still reported an error

Solution:

It’s really necessary to reduce the version. I’ve reduced it to [email protected] Version, then why do you report an error?I found that the imported path is screenfull under the module directory, but there is no corresponding index.js file

so we have to change the import path import ScreenFull from 'screenfull/dist/screenfull', the page will be displayed normally and the full screen function will be normal

Read More: