pixelmund / svelte-kit-cookie-session

⚒️ Encrypted "stateless" cookie sessions for SvelteKit
MIT License
184 stars 12 forks source link

Version 3.3.0 compilation process is broken #49

Closed cpibm closed 1 year ago

cpibm commented 1 year ago

When using the (latests) version 3.3.0 of the package, it seems the build or packaging process is broken because the whole app breaks with the following message:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '$app' imported from /<my_project>/node_modules/svelte-kit-cookie-session/utils.js
    at new NodeError (node:internal/errors:387:5)
    at packageResolve (node:internal/modules/esm/resolve:852:9)
    at moduleResolve (node:internal/modules/esm/resolve:901:20)
    at defaultResolve (node:internal/modules/esm/resolve:1115:11)
    at nextResolve (node:internal/modules/esm/loader:163:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:837:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40)
    at link (node:internal/modules/esm/module_job:75:36)

If I inspect the package, indeed the new imports remain but the packaged structure does not match the paths:

image

And this is the broken code:

image
pixelmund commented 1 year ago

Hey this should be fixed in v3.3.1, i accidentally imported RequestEvent from $types instead of @sveltejs/kit

LorenzoLeonardini commented 1 year ago

Hi, I'm still having this problem in v3.3.1, but the broken code to me looks like

import { dev } from '$app/environment';

in the file utils.js

pixelmund commented 1 year ago

Alright i think i got it now, probably can't use the $app module when packaging. It should work in 3.3.2.

cpibm commented 1 year ago

Thanks a lot! 3.3.2 does fix the issue.