Closed bartektelec closed 1 year ago
@bartektelec hello Bartek! 👋 could you provide a simple repro repo? (that would be helpful in debugging this problem)
https://github.com/bartektelec/tsbelt-server-test made a repo to reproduce.
I tried creating one on codesandbox, but for some reason it seems to be working just fine there. Locally, I tried yarn, pnpm and npm. I also tried running it through WSL2. I also tried switching between node 16 and 18. No luck.
> tsbelt-server-test@0.0.1 dev
> vite dev
VITE v4.0.4 ready in 1725 ms
➜ Local: http://localhost:5173/
➜ Network: use --host to expose
➜ press h to show help
(node:621) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
TypeError: Cannot read properties of undefined (reading 'A')
at load (/mnt/d/projects/tsbelt-server-test/src/routes/+page.server.ts:5:27)
at Module.load_server_data (/node_modules/@sveltejs/kit/src/runtime/server/page/load_data.js:33:41)
at /node_modules/@sveltejs/kit/src/runtime/server/page/index.js:167:18
at processTicksAndRejections (node:internal/process/task_queues:96:5)
6:45:02 PM [vite-plugin-svelte] ssr compile in progress ...
6:45:03 PM [vite-plugin-svelte] ssr compile done.
package files time avg
tsbelt-server-test 3 24.3ms 8.1ms
thanks @bartektelec! and final question, do you use ts-belt v3
or v4
?
I used 3.13.1
@bartektelec could you check using the latest version v4.0.0-rc.5
? (yarn add @mobily/ts-belt@next
)
That solved the issue! 🙌
@bartektelec that's great 🎉 and sorry for the inconvenience!
I have a project that I am creating with SvelteKit, ts-belt seems to work just fine on my client-side code:
However, when I try to run it in on of the server-side files (i.e. +page.server.ts) it throws an error:
I'm not sure if this is a SvelteKit issue, I haven't had that problem with any other library. Any ideas?