Description
What happened?
It appears the current version of this library is incompatible with babel-loader. Importing it into a React app causes the app to fail to compile with the following error:
./node_modules/react-idle-timer/dist/index.esm.js 239:8
Module parse failed: Unexpected token (239:8)
File was processed with these loaders:
* ./node_modules/react-scripts/node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| var Q = {},
| Ae = class {
> name;
| closed = !1;
| mc = new MessageChannel();
Reproduction Steps
1. Added package via `yarn add react-idle-timer`.
2. Imported into React app with `import { useIdleTimer } from 'react-idle-timer';`
3. Try to compile the app.
...
Relevant log output
[1] Failed to compile.
[1]
[1] ./node_modules/react-idle-timer/dist/index.esm.js 239:8
[1] Module parse failed: Unexpected token (239:8)
[1] File was processed with these loaders:
[1] * ./node_modules/react-scripts/node_modules/babel-loader/lib/index.js
[1] You may need an additional loader to handle the result of these loaders.
[1] | var Q = {},
[1] | Ae = class {
[1] > name;
[1] | closed = !1;
[1] | mc = new MessageChannel();
Screenshots or Additional Context
Babel versions from the main package.json file:
"@babel/cli": "^7.23.0", "@babel/core": "^7.23.2", "@babel/preset-env": "^7.23.2",
In the react app's yarn.lock file, babel-loader (required by react-scripts@4.0.3) is:
babel-loader@8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-8.1.0.tgz#c611d5112bd5209abe8b9fa84c3e4da25275f1c3" integrity sha512-7q7nC1tYOrqvUrN3LQK4GwSk/TQorZSOlO9C+RZDZpODgyN4ZlCqE5q9cDsyWOliN+aU9B4JX01xK9eJXowJLw== dependencies: find-cache-dir "^2.1.0" loader-utils "^1.4.0" mkdirp "^0.5.3" pify "^4.0.1" schema-utils "^2.6.5"
Module Version
5.7.2
What browsers are you seeing the problem on? Select all that apply.
Chrome
What devices are you seeing the problem on?
Desktop
Verification
- I have checked for existing closed issues and discussions.