sindresorhus / screenfull

Simple wrapper for cross-browser usage of the JavaScript Fullscreen API
https://sindresorhus.com/screenfull
MIT License
7.06k stars 698 forks source link

library throw loader error when import in react cra #197

Closed mmustafau closed 2 years ago

mmustafau commented 2 years ago

hi,

I want to use this library with react-player library.

At this official example,this package works fine. You can see demo

In my application it throws loaders error.

./node_modules/screenfull/index.js 105:54
Module parse failed: Unexpected token (105:54)
File was processed with these loaders:
  ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|   element: {
|     enumerable: true,
     get: () => document[nativeAPI.fullscreenElement] ?? undefined
|   },
|   isEnabled: {

package.json

 "react": "^16.13.1",
 "react-dom": "^16.13.1",
 "react-player": "^2.9.0",
 "react-router-dom": "^5.1.2",
 "redux": "^4.0.5",
 "redux-thunk": "^2.3.0",
 "react-scripts": "^4.0.3"

 "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },

Thanks for the help

sindresorhus commented 2 years ago

Duplicate of #195

mmustafau commented 2 years ago

As a quick workaround, You can downgrade screenfull version to 5.2.0. In version 6.0.0. engine is higher than node v.14.