Comments (13)
I have updated the README and going to close this issue now. I'm on UTC+1
from svelte-kit-cookie-session.
See #14
from svelte-kit-cookie-session.
If I move svelte-kit-cookie-session into devDependencies
then the error message changes:
1:22:41 PM [vite] Error when evaluating SSR module (REPOROOT)/src/hooks:
Error: Cannot find module 'svelte-kit-cookie-session' from '(REPOROOT)/src'
And then pnpm run build
works but pnpm run preview
does not:
> (PROJECTNAME)@0.0.1 preview (REPOROOT)
> svelte-kit preview
> Cannot find package '(REPOROOT)/node_modules/svelte-kit-cookie-session/' imported from (REPOROOT)/.svelte-kit/output/server/app.js
This is all with the latest Svelte-Kit and Vite, BTW.
from svelte-kit-cookie-session.
I haven't quite figured out which vite config is helpful here. Would be happy to include something in the README.
from svelte-kit-cookie-session.
Saw your reference to vitejs/vite#728 which does look like exactly the issue... but that issue is closed and locked, so I bet the Vite developers aren't tracking it. I wonder if I should open a new issue in Vite to report this? I bet we could boil this down to a VERY simple reproduction with no Svelte-Kit in the mix, so that the Vite devs don't end up thinking the problem is in Svelte-Kit.
Hmm. I'll hold off on opening a Vite issue until I have a Vite-only repro, I think. But it's definitely something VIte-side that's causing this.
from svelte-kit-cookie-session.
This seems definetly like a Vite issue, i'm trying around with the vite config to see if i can solve this issue that way.
from svelte-kit-cookie-session.
@rmunn @chbert I found 2 different solution, this is the easiest one which should work..
const config = {
kit: {
vite: {
optimizeDeps: {
exclude: ['svelte-kit-cookie-session'],
},
},
},
};
from svelte-kit-cookie-session.
@pixelmund That doesn't work for me. I also tried optimizeDeps: { esbuildOptions: { platform: 'neutral' } }
without checking dev and I'm still getting "error: Could not read from file: (REPOROOT)/crypto". The app does run and correctly decrypts and encrypts session cookies, but esbuildOptions: { platform: 'neutral' }
isn't working.
I also tried this:
optimizeDeps: {
allowNodeBuiltins: ['crypto'],
esbuildOptions: { platform: 'neutral' }
}
But that didn't change anything; I'm still getting the same "Could not read from file" error.
from svelte-kit-cookie-session.
So did you try the exclude
one?
I can't reproduce it anymore, even after deleting node_modules
the exclude
did the trick..
from svelte-kit-cookie-session.
Just tried exclude
and it worked -- before seeing your comment edit above. :-)
optimizeDeps: {
exclude: ['svelte-kit-cookie-session'],
}
That was enough to get rid of the Vite error.
from svelte-kit-cookie-session.
Perfect, i'm adding it to the readme. Thanks for verifying :-)
from svelte-kit-cookie-session.
Note that svelte-kit-cookie-session does need to be in dependencies
, not devDependencies
, or I still get "Error: Cannot find module 'svelte-kit-cookie-session' from '(REPOROOT)/src'".
from svelte-kit-cookie-session.
Perfect, i'm adding it to the readme. Thanks for verifying :-)
Great; I'll close the issue once the README is updated, or you can close it if I don't get to it. (I'm in a far eastern timezone, UTC+lots, so I go to sleep while most of America is just waking up).
from svelte-kit-cookie-session.
Related Issues (20)
- Consider `SameSite=Lax` as a new default HOT 2
- Build Fails in Vercel HOT 2
- Could this work with @sveltejs/adapter-cloudflare? HOT 5
- Security of Hashing Algorithm HOT 3
- Is this safe against cookie theft and replay attacks after expiry? HOT 3
- Support for SvelteKit@next-415+ HOT 8
- Document cookie options HOT 2
- Session Cookie not being set in safari HOT 2
- Hook for setting initial session state HOT 2
- SvelteKit Session Cookie and Houdini HOT 1
- Version 3.3.0 compilation process is broken HOT 4
- Can't build when using env var as secret HOT 3
- Feat: Chunked cookies HOT 4
- Question: Svelte only compatible ? HOT 2
- Iniitalizing guide update HOT 1
- init() doesn't set initial cookie until set() or update() is called HOT 2
- Need to expire cookies in minutes instead of days. HOT 4
- Svelte 4? HOT 1
- Secure to pass sensitive session data to page?
- Add support for CHIPS via Partitioned cookie attribute
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from svelte-kit-cookie-session.