Giter Club home page Giter Club logo

Comments (13)

pixelmund avatar pixelmund commented on May 23, 2024 1

I have updated the README and going to close this issue now. I'm on UTC+1

from svelte-kit-cookie-session.

pixelmund avatar pixelmund commented on May 23, 2024

See #14

from svelte-kit-cookie-session.

rmunn avatar rmunn commented on May 23, 2024

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.

pixelmund avatar pixelmund commented on May 23, 2024

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.

rmunn avatar rmunn commented on May 23, 2024

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.

pixelmund avatar pixelmund commented on May 23, 2024

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.

pixelmund avatar pixelmund commented on May 23, 2024

@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.

rmunn avatar rmunn commented on May 23, 2024

@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.

pixelmund avatar pixelmund commented on May 23, 2024

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.

rmunn avatar rmunn commented on May 23, 2024

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.

pixelmund avatar pixelmund commented on May 23, 2024

Perfect, i'm adding it to the readme. Thanks for verifying :-)

from svelte-kit-cookie-session.

rmunn avatar rmunn commented on May 23, 2024

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.

rmunn avatar rmunn commented on May 23, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.