sindresorhus/screenfull

You may need an appropriate loader to handle this file type

AK47-dadada opened this issue · 6 comments

Hi, I meet below problem when using your project:

The steps are as follows:
npm install screenfull

import screenfull from 'screenfull'

And then I got an error
image

I wonder what the reason is

namnm commented

@sindresorhus You can see it shows the error in this line:
const exitFullscreenMethod = methodList?.[1];
Which doesnt related to ESM, but optional the chaining operator ?.[1]

Getting same issue with Angular 11. I wonder how this issue is marked as closed. Does anybody resolve it?

I finally found a solution:

The reason is that by default babel-loader ignores all files in node_modules,
At this point you may need to configure Webpack's babel-loader to load properly
Please refer to https://webpack.js.org/loaders/babel-loader/

So in the VueCli project, you simply configure the transpileDependencies property in vue.config.js and enter the plug-in name as a string

module.exports = { // code transpileDependencies: ['screenfull'] // code }

Getting same issue with Angular 11. I wonder how this issue is marked as closed. Does anybody resolve it?

The reason is that by default babel-loader ignores all files in node_modules,
At this point you may need to configure Webpack's babel-loader to load properly
Please refer to https://webpack.js.org/loaders/babel-loader/