FormidableLabs / nuka-carousel

Small, fast, and accessibility-first React carousel library with an easily customizable UI and behavior to fit your brand and site.
https://commerce.nearform.com/open-source/nuka-carousel
Other
3.07k stars 595 forks source link

Uncaught SyntaxError: The requested module '/node_modules/.vite/deps/nuka-carousel.js?v=0039cf81' does not provide an export named 'default' #1066

Open one-god opened 3 months ago

one-god commented 3 months ago

Is there an existing issue for this?

Code of Conduct

Code Sandbox link

No response

Bug report

Uncaught SyntaxError: The requested module '/node_modules/.vite/deps/nuka-carousel.js?v=0039cf81' does not provide an export named 'default'
rafyzg commented 2 months ago

Experiencing the same issue

Vesals commented 1 month ago

me too!! this happens when i try to call SlideHandle

carbonrobot commented 1 month ago

Does anyone have a code example to reproduce it? I am unable to reproduce it using a new Vite project.

Vesals commented 1 month ago

Does anyone have a code example to reproduce it? I am unable to reproduce it using a new Vite project.

Hi, sorry for the late reply. In my case (React Vite Project), I’m following the example from the Methods section of the official documentation. I tried importing like this: import { Carousel, SlideHandle } from 'nuka-carousel' and also like this: import SlideHandle, { Carousel } from 'nuka-carousel'.

However, even though I haven’t yet called SlideHandle in my useRef, I received the same error message in both cases and caused my page to go blank. The console error is as follows: Uncaught SyntaxError: The requested module '/node_modules/.vite/deps/nuka-carousel.js?v=b2b01556' does not provide an export named 'default'.

I hope this provides some insight. Thank you!

carbonrobot commented 1 month ago

Can you tell me what version of Vite you are using and possibly share your vite.config.ts file?

Vesals commented 1 month ago

Can you tell me what version of Vite you are using and possibly share your vite.config.ts file?

Sure, my Vite version is "vite": "^5.4.1", and here is my vite.config.ts file:

import { defineConfig } from 'vite'
import path from 'path'
import react from '@vitejs/plugin-react'

export default defineConfig({
  server: { port: 3000 },

  plugins: [react()],

  resolve: {
    alias: {
      // eslint-disable-next-line no-undef
      '~': path.resolve(__dirname, './src')
    }
  }
})

image

carbonrobot commented 1 month ago

Thats essentially the same as our test app, assuming you didn't customize the TSConfigs to use a different bundler. This may be related, but I don't think this is an issue with nuka.