svelte-paginate icon indicating copy to clipboard operation
svelte-paginate copied to clipboard

export 'paginate' (imported as 'paginate') was not found in 'svelte-paginate'

Open toadle opened this issue 1 year ago • 2 comments

Hey there,

today I was trying to use svelte-paginate in my Golang-Buffalo-Project, which runs a webpacke-configuration of svelte using svelte-loader as described in the official documentation.

I run into a loading/resolving error that I cannot figure out. I do NOT use TypeScript:

WARNING in ./assets/js/components/SearchApp.svelte 498:39-47
export 'paginate' (imported as 'paginate') was not found in 'svelte-paginate' (possible exports: DarkPaginationNav, LightPaginationNav, PaginationNav)
 @ ./assets/js/search.js 1:0-54 2:16-25

I see more consequent(?) errors:

ERROR in ./node_modules/svelte-paginate/generateNavigationOptions.js 1:0-37
Module not found: Error: Can't resolve './types' in '/Users/tim/Workspace/wescale/wapiti/node_modules/svelte-paginate'
Did you mean 'types.js'?
BREAKING CHANGE: The request './types' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request

and the same for paginate after that:

ERROR in ./node_modules/svelte-paginate/index.js 1:0-38
Module not found: Error: Can't resolve './paginate' in '/Users/tim/Workspace/wescale/wapiti/node_modules/svelte-paginate'
Did you mean 'paginate.js'?
BREAKING CHANGE: The request './paginate' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.

I use this to import svelte-paginate:

  import { paginate, LightPaginationNav } from 'svelte-paginate'
  ...

  let results = [];
  let currentPage = 1;
  let pageSize = 50;
  $: paginatedItems = paginate({ items: results, pageSize, currentPage })

Any ideas?

toadle avatar Oct 30 '23 09:10 toadle

After adding this to the svelte-paginate package.json it worked:

...
"browser": {
    "./package.json": "./package.json",
    "./DarkPaginationNav.svelte": "./DarkPaginationNav.svelte",
    "./LightPaginationNav.svelte": "./LightPaginationNav.svelte",
    "./PaginationNav.svelte": "./PaginationNav.svelte",
    "./generateNavigationOptions": "./generateNavigationOptions.js",
    ".": "./index.js",
    "./paginate": "./paginate.js",
    "./types": "./types.js"
  },
...

toadle avatar Oct 30 '23 09:10 toadle

@TahaSh Any ideas? Is this a problem on my side?

toadle avatar Nov 06 '23 13:11 toadle