Vite not loading the SDK
See original GitHub issue- SDK version: 0.2.1
- OS: MacOS 12.4
- Node version: 16.16.0 LTS (also tested with 16.6.0)
- Package manager: Yarn 1.22.19 (also tested with NPM)
So I installed PocketBase and wanted to create a little web to test the tool. I’m a Vue developer so I went ahead and create a new project with the official Vue tool (yarn create vue).
I installed the PocketBase NodeJS package and cross-fetch since I was in NodeJS 16.16.0. Created a little script to list the handmade collections that I created via the Admin UI and It refuses to even been imported to the project.
My code in Vue:
<script setup lang="ts">
import 'cross-fetch/polyfill'
import PocketBase from 'pocketbase'
const client = new PocketBase('http://localhost:8090')
const record = await client.Records.getList('demo')
console.log(record)
</script>
<template>
<main>
<h1>Hello Vue + PocketBase!</h1>
</main>
</template>
I get this error when the dev server start:
$ vite
vite v2.9.14 dev server running at:
> Local: http://localhost:3000/
> Network: use `--host` to expose
ready in 161ms.
✘ [ERROR] Do not know how to load path: pocketbase
19:32:31 [vite] error while updating dependencies:
Error: Build failed with 1 error:
error: Do not know how to load path: pocketbase
at failureErrorWithLog (/Users/alejandropp/dev/chatty/node_modules/esbuild/lib/main.js:1605:15)
at /Users/alejandropp/dev/chatty/node_modules/esbuild/lib/main.js:1251:28
at runOnEndCallbacks (/Users/alejandropp/dev/chatty/node_modules/esbuild/lib/main.js:1034:63)
at buildResponseToResult (/Users/alejandropp/dev/chatty/node_modules/esbuild/lib/main.js:1249:7)
at /Users/alejandropp/dev/chatty/node_modules/esbuild/lib/main.js:1358:14
at /Users/alejandropp/dev/chatty/node_modules/esbuild/lib/main.js:666:9
at handleIncomingPacket (/Users/alejandropp/dev/chatty/node_modules/esbuild/lib/main.js:763:9)
at Socket.readFromStdout (/Users/alejandropp/dev/chatty/node_modules/esbuild/lib/main.js:632:7)
at Socket.emit (node:events:527:28)
at addChunk (node:internal/streams/readable:315:12)
So I made sure that the PocketBase SDK was install, and yes, It’s present in the node_modules folder and VS Code Intellisense correctly opens the SDK’s folder when I search for the import’s origin.
I’m a junior developer and I have no idea what could be happening. But by the error log, I suppose that I related to Vite and ESBuild module resolution. Hope this helps to improve the SDK, PocketBase seems like a great product!
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)

Top Related StackOverflow Question
Well, this is awkward.
Everything seems to be working now. I missed something for sure. Thanks a lot and sorry for wasting your time in this little thing 😅
@ByScripts I guess this depends on what load transformers are enabled but yes, some bundlers allow importing local files.
I’ve just tried it and I wasn’t able to reproduce it directly (default sveltekit with vite3) but if I add a path delimiter to the import statement (eg.
/pocketbaseor./pocketbase) it will indeed will try to load the binary from the file system.Anyway, thank you for letting me know. If other users happened to stumble on the same thing, I may consider mentioning it somewhere in the readme.