!NhAsaYbbgmzHtXTPQJ:funklause.de

Nix NodeJS

199 Members
57 Servers

Load older messages


SenderMessageTime
21 Dec 2023
@lily:lily.flowersLily Foster
In reply to @peter-lustig:matrix.org
because what i really wonder is why npm run build works and nix build errors out
there is no npm/nix difference here. the difference is you are baking in variables that you are making available in your local env but not in your build env
16:08:51
@lily:lily.flowersLily Foster
In reply to @peter-lustig:matrix.org
because what i really wonder is why npm run build works and nix build errors out
* there is no npm/nix difference here. the difference is you are baking in variables that you are making available in your local env but not in your nix build env
16:08:55
@lily:lily.flowersLily Fosterfrom what i can tell anyway16:09:10
@peter-lustig:matrix.orgpeter-lustig
In reply to @lily:lily.flowers
i mean again, the fake values will let it build, but if it's baking them in, it won't work. you could put real values in there but then you'd have world-readable secrets
for runtime i am passing the env variables via dotenv and command line arguments with agenix, so to be honest I just need to have it building
16:09:11
@peter-lustig:matrix.orgpeter-lustiglemme try the fake values16:09:26
@lily:lily.flowersLily Foster
In reply to @peter-lustig:matrix.org
for runtime i am passing the env variables via dotenv and command line arguments with agenix, so to be honest I just need to have it building
yeah but svelte explicitly says the values are baked in at build time. how would it be grabbing them at runtime if you don't have other code to do such?
16:09:46
@lily:lily.flowersLily Foster

If the user lands on a prerendered page, SvelteKit will request up-to-date values for $env/dynamic/public from the server (by default from a module called _env.js ...)

16:10:14
@lily:lily.flowersLily Fosterah16:10:15
@lily:lily.flowersLily Fosterthat sounds .... weird. but that does mean fake values might work?16:10:26
@peter-lustig:matrix.orgpeter-lustigI will try now xd16:10:37
@lily:lily.flowersLily Fosteri do hope it is that simple!16:11:21
@lily:lily.flowersLily Fosternot sure how many variables you have in the file, but you will likely need to define all of them16:11:46
@lily:lily.flowersLily Fosteri wonder why svelte doesn't have a way to say "this won't be needed at build time, just put a blank value in"16:12:02
@peter-lustig:matrix.orgpeter-lustigjust four16:12:08
@peter-lustig:matrix.orgpeter-lustig
In reply to @lily:lily.flowers
i wonder why svelte doesn't have a way to say "this won't be needed at build time, just put a blank value in"
idk maybe they do but not many people use sveltekit compared to react for example so finding stuff out is usually difficult
16:12:34
@lily:lily.flowersLily Foster
In reply to @peter-lustig:matrix.org
idk maybe they do but not many people use sveltekit compared to react for example so finding stuff out is usually difficult
that's pretty fair tbh, i could totally see that
16:12:53
@peter-lustig:matrix.orgpeter-lustigok so now the stuff builds16:13:05
@peter-lustig:matrix.orgpeter-lustigi guess it would just work now, let me test this in production16:13:13
@peter-lustig:matrix.orgpeter-lustig
In reply to @lily:lily.flowers
there is no npm/nix difference here. the difference is you are baking in variables that you are making available in your local env but not in your nix build env
ah i thought nix could read my local .env file
16:13:49
@peter-lustig:matrix.orgpeter-lustigwith some magic xd16:15:58
@peter-lustig:matrix.orgpeter-lustig Okayyy Lily Foster, so this does not work 16:16:47
@peter-lustig:matrix.orgpeter-lustignow in production the variables are also empty strings apparently16:16:59
@lily:lily.flowersLily Fosteri was worried about that16:17:29
@lily:lily.flowersLily Fosterlet me dive more into the svelte docs16:17:38
@lily:lily.flowersLily Fosterbecause you should be pulling these values at runtime rather than build time, and ideally not even require them to be set at all during build time. but idk svelte16:18:00
@lily:lily.flowersLily Foster * because you should be pulling these values at runtime rather than build time, and ideally not even require them to be set at all during build time. but idk very much about svelte16:18:05
@lily:lily.flowersLily Foster

by default from a module called _env.js — this can be configured with config.kit.env.publicModule

do you know what this part of the doc you mentioned means?

16:19:14
@lily:lily.flowersLily Fosteris that how env vars should be passed in at runtime?16:19:22
@peter-lustig:matrix.orgpeter-lustigthat line confused me too16:19:38
@lily:lily.flowersLily Fosterwait, i just realized, does this mean you are importing these vars into client-side code, if it is attempting to pre-render it?16:20:24

Show newer messages


Back to Room ListRoom Version: 6