Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't import Glide from "@glidejs/glide", but can import Glide from "@glidejs/glide/dist/glide.esm.js" #2802

Closed
revosw opened this issue Nov 19, 2024 · 1 comment · Fixed by glidejs/glide#700

Comments

@revosw
Copy link

revosw commented Nov 19, 2024

Which project does this relate to?

Start

Describe the bug

When importing @glidejs/glide and doing new Glide() anywhere in a TanStack Start app, I get the error:

10:48:20 AM [vite] Error when evaluating SSR module /app/routes/__root.tsx: failed to import "@glidejs/glide"
|- SyntaxError: [vite] The requested module '@glidejs/glide' does not provide an export named 'default'
    at analyzeImportedModDifference (file:///home/projects/tanstack-router-qngteg/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:52102:15)
    at nodeImport (file:///home/projects/tanstack-router-qngteg/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:53109:5)
    at async ssrImport (file:///home/projects/tanstack-router-qngteg/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:52963:16)
    at async eval (/home/projects/tanstack-router-qngteg/app/routes/__root.tsx:5:31)
    at async instantiateModule (file:///home/projects/tanstack-router-qngteg/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:53021:5)

10:48:20 AM [vite] Error when evaluating SSR module /app/routeTree.gen.ts: failed to import "@glidejs/glide"
|- SyntaxError: [vite] The requested module '@glidejs/glide' does not provide an export named 'default'
    at analyzeImportedModDifference (file:///home/projects/tanstack-router-qngteg/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:52102:15)
    at nodeImport (file:///home/projects/tanstack-router-qngteg/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:53109:5)
    at async ssrImport (file:///home/projects/tanstack-router-qngteg/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:52963:16)
    at async eval (/home/projects/tanstack-router-qngteg/app/routes/__root.tsx:5:31)
    at async instantiateModule (file:///home/projects/tanstack-router-qngteg/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:53021:5)

10:48:20 AM [vite] Error when evaluating SSR module /app/router.tsx: failed to import "@glidejs/glide"
|- SyntaxError: [vite] The requested module '@glidejs/glide' does not provide an export named 'default'
    at analyzeImportedModDifference (file:///home/projects/tanstack-router-qngteg/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:52102:15)
    at nodeImport (file:///home/projects/tanstack-router-qngteg/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:53109:5)
    at async ssrImport (file:///home/projects/tanstack-router-qngteg/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:52963:16)
    at async eval (/home/projects/tanstack-router-qngteg/app/routes/__root.tsx:5:31)
    at async instantiateModule (file:///home/projects/tanstack-router-qngteg/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:53021:5)

10:48:20 AM [vite] Error when evaluating SSR module /app/ssr.tsx: failed to import "@glidejs/glide"
|- SyntaxError: [vite] The requested module '@glidejs/glide' does not provide an export named 'default'
    at analyzeImportedModDifference (file:///home/projects/tanstack-router-qngteg/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:52102:15)
    at nodeImport (file:///home/projects/tanstack-router-qngteg/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:53109:5)
    at async ssrImport (file:///home/projects/tanstack-router-qngteg/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:52963:16)
    at async eval (/home/projects/tanstack-router-qngteg/app/routes/__root.tsx:5:31)
    at async instantiateModule (file:///home/projects/tanstack-router-qngteg/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:53021:5)

10:48:20 AM [vite] Error when evaluating SSR module $vinxi/handler/ssr: failed to import "@glidejs/glide"
|- SyntaxError: [vite] The requested module '@glidejs/glide' does not provide an export named 'default'
    at analyzeImportedModDifference (file:///home/projects/tanstack-router-qngteg/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:52102:15)
    at nodeImport (file:///home/projects/tanstack-router-qngteg/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:53109:5)
    at async ssrImport (file:///home/projects/tanstack-router-qngteg/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:52963:16)
    at async eval (/home/projects/tanstack-router-qngteg/app/routes/__root.tsx:5:31)
    at async instantiateModule (file:///home/projects/tanstack-router-qngteg/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:53021:5)

However, when I do import Glide from "@glidejs/glide/dist/glide.esm.js", it works fine

Your Example Website or App

https://stackblitz.com/edit/tanstack-router-qngteg?file=app%2Froutes%2F__root.tsx

Steps to Reproduce the Bug or Issue

  1. npm install @glidejs/glide
  2. import Glide from "@glidejs/glide" inside for example __root.tsx
  3. Try to use Glide with new Glide({})
  4. Getting the error

Expected behavior

The module should have been resolved, and the Glide function should have been imported

Screenshots or Videos

No response

Platform

  • OS: Windows (but error happens in Stackblitz as well)
  • Browser: Microsoft Edge
  • Version: 131.0.2903.51 (Official build) (64-bit)

Additional context

No response

schiller-manuel added a commit to schiller-manuel/glide that referenced this issue Nov 19, 2024
@schiller-manuel
Copy link
Contributor

this dependency misses an exports section in its package.json.
If you add this, it works:

  "exports": {
    ".": {
      "import": "./dist/glide.esm.js",
      "require": "./dist/glide.js",
      "default": "./dist/glide.esm.js"
    }
  },

I created a PR for this: glidejs/glide#700

jedrzejchalubek pushed a commit to glidejs/glide that referenced this issue Nov 20, 2024
@schiller-manuel schiller-manuel closed this as not planned Won't fix, can't repro, duplicate, stale Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants