react-splide icon indicating copy to clipboard operation
react-splide copied to clipboard

Nextjs app directory not working with react-splide

Open adityanrlhmd opened this issue 2 years ago • 2 comments

Checks

  • [X] Not a duplicate.
  • [X] Not a question, feature request, or anything other than a bug report directly related to React Splide. Use Discussions for these topics: https://github.com/Splidejs/splide/discussions

Version

0.7.12

Description

When i build next js 14

Type error: Could not find a declaration file for module '@splidejs/react-splide'. '/Users/aditya/Desktop/Office/react/b2b-web/node_modules/@splidejs/react-splide/dist/js/react-splide.esm.js' implicitly has an 'any' type. There are types at '/Users/aditya/Desktop/Office/react/b2b-web/node_modules/@splidejs/react-splide/dist/types/index.d.ts', but this result could not be resolved when respecting package.json "exports". The '@splidejs/react-splide' library may need to update its package.json or typings.

Reproduction Link

No response

Steps to Reproduce

used in client components Next 14

Expected Behaviour

Work with nextjs 14 to build prod

adityanrlhmd avatar Nov 23 '23 10:11 adityanrlhmd

@adityanrlhmd yo bro! you can add a global.d.ts and paste this line:

declare module '@splidejs/react-splide';

Will type splide as any, but the project will run and build

ddumst avatar Jan 10 '24 17:01 ddumst

Once the developer is not updating this package anymore, I forked it and fixed the issue exporting the types that are not being exported. https://github.com/patrickn2/react-splide

patrickn2 avatar Apr 03 '24 00:04 patrickn2