Giter Club home page Giter Club logo

Comments (6)

SupremeTechnopriest avatar SupremeTechnopriest commented on June 2, 2024 8

Sounds like you are using an old version of webpack or node. Try using the full path:

import { useIdleTimer } from 'react-idle-timer/dist/index.legacy.cjs.js'

or if you want ECMAScript modules:

import { useIdleTimer } from 'react-idle-timer/dist/index.legacy.esm.js'

from react-idle-timer.

SmudgeLord200 avatar SmudgeLord200 commented on June 2, 2024 2

Huge thanks. It worked.

from react-idle-timer.

SupremeTechnopriest avatar SupremeTechnopriest commented on June 2, 2024 1

Glad to help!

from react-idle-timer.

SupremeTechnopriest avatar SupremeTechnopriest commented on June 2, 2024

Hey there! If you are having issues with bundling es6 code you can try the new legacy build. Details are here:

https://idletimer.dev/docs/getting-started/installation#legacy-browser-support

If you are using a modern node you can just change:

import { useIdleTImer } from 'react-idle-timer'

to:

import { useIdleTImer } from 'react-idle-timer/legacy'

Please reopen this issue if you are still having problems.

from react-idle-timer.

SmudgeLord200 avatar SmudgeLord200 commented on June 2, 2024

Hi, I updated to the latest version 5.7.0 and tried your suggestion. But it gave me another error of Module not found: Can't resolve 'react-idle-timer/legacy' in myTimer.js. When I removed the /legacy, it gave me the same old error. And I don't think I have the rights to reopen issue here. Thanks.

from react-idle-timer.

SVenkat99 avatar SVenkat99 commented on June 2, 2024

@SupremeTechnopriest - I have tried implementing this in React with Typescript project, and getting below error. Could not find a declaration file for module 'react-idle-timer/dist/index.legacy.esm.js'.

from react-idle-timer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.