Skip to content

[Bug]: importing react-idle-timer causes SyntaxError #2819

@TheWeirdDev

Description

@TheWeirdDev

Version

System:
    OS: Linux 6.9 Arch Linux
    CPU: (8) x64 Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
    Memory: 10.94 GB / 19.29 GB
    Container: Yes
    Shell: 3.7.1 - /bin/fish
  Browsers:
    Chromium: 126.0.6478.126
  npmPackages:
    @rsbuild/core: 1.0.0-alpha.4 => 1.0.0-alpha.4 
    @rsbuild/plugin-react: 1.0.0-alpha.4 => 1.0.0-alpha.4

Details

Using react-idle-timer in a react project causes SyntaxError:

vendors-node_modules…ack_c-32d00f.js:288 
 Uncaught  SyntaxError: Unexpected token ';' (at vendors-node_modules…32d00f.js:288:21525)

Reproduce link

https://codesandbox.io/p/devbox/wqrg9x

Reproduce Steps

  1. Create a new react ts project using pnpm create rsbuild@latest
  2. Add 'react-idle-timer' as a dependency: pnpm i react-idle-timer
  3. Modify the App component to use idle timer:
import { withIdleTimer } from "react-idle-timer";
import './App.css';

const App = () => {
 return (
   <div className="content">
     <h1>Rsbuild with React</h1>
     <p>Start building amazing things with Rsbuild.</p>
   </div>
 );
};

export default withIdleTimer(App);
  1. Run the dev server: pnpm run dev
  2. Observe the syntax error message in Chrome DevTools

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions