|
teen phone cutie posted:these are the type of software projects that make me feel like i need to be doing something else with my life. this is 1000x cooler than anything i'll ever work on for every developer that does something like this there are probably a million that just do business line work. if i compare myself to jarred sumner i'm just gonna get depressed so I just try to compare myself to myself from a year ago. i'm way smarter than that guy.
|
# ? Sep 13, 2023 20:54 |
|
|
# ? May 16, 2024 07:31 |
|
I'm having trouble figuring out coroutines. This is Typescript.code:
|
# ? Sep 14, 2023 07:11 |
Vino posted:I'm having trouble figuring out coroutines. This is Typescript. I think you're trying to yield an undefined value - isn't that what 'yield' with no argument does?
|
|
# ? Sep 14, 2023 09:17 |
|
This seems to work, vanilla jsJavaScript code:
|
# ? Sep 14, 2023 16:29 |
|
Vino posted:I'm having trouble figuring out coroutines. This is Typescript. I found this code sample which I think is what you're looking for: code:
|
# ? Sep 14, 2023 17:28 |
|
teen phone cutie posted:just installed our node_modules with bun instead of npm and it was 1.7 seconds vs. 14 Global cache w/ the packages already un-tarred and the files hard linked in. You're sharing your node_modules with every other installation on your hard drive, that's the tradeoff.
|
# ? Sep 14, 2023 20:57 |
|
El Gar posted:Global cache w/ the packages already un-tarred and the files hard linked in. You're sharing your node_modules with every other installation on your hard drive, that's the tradeoff. are you loving kidding me??
|
# ? Sep 14, 2023 21:58 |
|
No. Thats how pnp or whatever works too, if I remember right.
|
# ? Sep 14, 2023 22:32 |
|
I went to convert a project to bun last night. All went well until I saw it just doesn't work with Electron. That's a bummer.teen phone cutie posted:are you loving kidding me?? Why is this so wrong?
|
# ? Sep 15, 2023 00:06 |
|
huhu posted:I went to convert a project to bun last night. All went well until I saw it just doesn't work with Electron. That's a bummer. How were you expecting that to work? Electron is literally Blink + NodeJS https://github.com/electron/electron/issues/34876 Electron barely supports NodeJS properly, like where is ESM support? There are alternatives that use Webkit instead of Blink, although how ugly they are https://github.com/Elanis/web-to-desktop-framework-comparison Also comedy option, WPE: https://webkit.org/wpe/ MrMoo fucked around with this message at 01:20 on Sep 15, 2023 |
# ? Sep 15, 2023 00:36 |
|
huhu posted:Why is this so wrong? A decent number of packages broke when yarn did it but that was years ago so I would think most stuff can deal with a shared location now.
|
# ? Sep 15, 2023 01:33 |
|
huhu posted:I found this code sample which I think is what you're looking for: OK so looks like you can read a value from yield so long as you also actually yield a value. Makes sense I suppose. Just confuses me because if you don't yield a value the type of yield is undefined but if you do yield it the type is not the type of what you yielded but the type that was passed into next(). Could be a language bug. edit: Also works if you make the first template parameter of Generator have |undefined edit 2: Oh wait I misunderstood the message, it's talking about the 'parameter' of yield. Not a language bug. Vino fucked around with this message at 02:39 on Sep 15, 2023 |
# ? Sep 15, 2023 02:24 |
|
MrMoo posted:Electron barely supports NodeJS properly, like where is ESM support?
|
# ? Sep 15, 2023 06:18 |
|
necrotic posted:No. Thats how pnp or whatever works too, if I remember right. Yes pnpm works the same way. huhu posted:Why is this so wrong? Nothing inherently wrong with this it's just a different way of doing things. It's up to you to decide if you're ok with it. smackfu posted:A decent number of packages broke when yarn did it but that was years ago so I would think most stuff can deal with a shared location now. Yarn has a "pnp" mode still it's just not the default. npm has one too but it still untars the package from the cache and each project is in isolation from the next, untarred packages are in a local ".store/" directory inside node_modules.
|
# ? Sep 15, 2023 18:21 |
|
I have imports in my code rather than requires and everything was going relatively fine until I tried to start using electron and now I am getting real strange errors. Im hoping someone will tell me a magic bean to fix this but if not, what are my options? 1. Update to a new version of everything to see if theres a bug somewhere 2. Change my toolset to emit code using require and integrate some common js browser polyfill Both of these seem like huge pains in my asses mainly because I still have no idea what Im doing and none of this has anything to do with making my game. Any pointers? Of all JavaScript quirks by far the one that has been giving me the most problems is the whole modules situation, where some stuff uses require and other import and never the twain shall meet. What a mess.
|
# ? Sep 17, 2023 08:53 |
|
Electron didnt support ESM, ie JavaScript modules. Apparently nightly builds do. Electron is very much behind on NodeJS support. The renderer threads should be ok. But not the preload.
|
# ? Sep 17, 2023 14:48 |
|
Oh interesting thats reasonably good news. I googled around and found a lot of references to adding ESM support to electron but some of them were very old except for this one https://github.com/electron/electron/pull/37535 That one is only six months old. It says in the comments its in nightly right now. Is that what you mean?
|
# ? Sep 17, 2023 17:01 |
|
Yeah, that's the PR for ESM. Last I tried, it can't resolve ESM modules properly, when they're inside an asar. It doesn't walk up the directory tree to look into other node_modules directories. Works fine for a loose unpacked resource directory, tho. So if you're using a deduped module tree, you're SOL.
|
# ? Sep 17, 2023 19:10 |
|
The critical piece that is still non-final is import maps, you really need them to make module resolution not insane.
|
# ? Sep 17, 2023 19:54 |
|
First I tried to use electron nightly and it's easy enough to get npm to download electron nightly but I was unable to figure out how to get the build process working (electron-forge make) with the nightly, or even to get the nightly to run my game So I figured maybe I would wait out the nightly being promoted to stable and in the meantime have the typescript compiler spit out CommonJS modules and use some kind of CommonJS browser implementation to get (number 2 from my list from before) I tried common.js, which had some stupid and obvious bugs that I don't know how they ever managed to release software with clearly obvious bugs like that I tried browserify, and I got stuck at an un-googlable error I'm currently looking at webpack and webmake but I'm exhausted Hoping someone here has a better solution?
|
# ? Sep 18, 2023 03:57 |
|
Vino posted:First I tried to use electron nightly and it's easy enough to get npm to download electron nightly but I was unable to figure out how to get the build process working (electron-forge make) with the nightly, or even to get the nightly to run my game I built an Electron app like a year ago and knew my build process was poo poo. Wanted to redo it. I started here https://www.electronforge.io/guides/framework-integration/react-with-typescript and got a basic boilerplate Electron, react, webpack, and ts helloworld app(what my project is written in) up and working. Then I copied my old React app code and Electron app code over bit by bit until everything was working. Took maybe an hour or two. Had to fight with a few cryptic errors but they were all googleable.
|
# ? Sep 18, 2023 07:53 |
|
I'm writing my first serious application backend in JavaScript and need a session library. All signs point to express-session, but I'm not using express. This application is SvelteKit, if that matters. I'm hoping to find a session library that's framework/server neutral. Any suggestions?
|
# ? Sep 18, 2023 19:28 |
|
You can use express with sveltekit https://kit.svelte.dev/docs/adapter-node#custom-server If you opted for another server, surely it has a session middleware that can be used.
|
# ? Sep 18, 2023 20:21 |
|
Edit - For whatever loving reason, Electron just spits out jibberish at you if two duplicate apps are open at the same time... Whelp now I got Electron issues. Curious if anyone might know where to look next. I used the following CLI to bootstrap an Electron App code:
I then moved all my React code over from my old project. I can run electron-forge start just fine and do local development. However, when I do electron-forge package, the app opens with the following rendering as HTML code:
Any clues that stand out here? huhu fucked around with this message at 06:05 on Sep 19, 2023 |
# ? Sep 19, 2023 05:50 |
|
necrotic posted:You can use express with sveltekit Thanks, I'd overlooked that completely. From the example and StackOverflow chatter, using a custom server breaks the nice live dev refresh from Vite since it depends on the prod build output. To preserve that dev behavior, I might be stuck rolling my own non-middleware session handler :/
|
# ? Sep 19, 2023 14:07 |
|
huhu posted:Edit - For whatever loving reason, Electron just spits out jibberish at you if two duplicate apps are open at the same time... The Electron API covers this, you can find many examples of workarounds before this came to be https://github.com/electron/electron/blob/main/docs/api/app.md#apprequestsingleinstancelock Of course noted on Snackoverflow, https://stackoverflow.com/a/52633637
|
# ? Sep 19, 2023 18:59 |
|
MrMoo posted:The Electron API covers this, you can find many examples of workarounds before this came to be Now I'm getting the error code:
code:
|
# ? Sep 19, 2023 23:04 |
|
huhu posted:
It vaguely resembles the garbage you'd get when UTF-8 is parsed as extended ASCII / ISO-8859 text
|
# ? Sep 19, 2023 23:49 |
|
edit: wrong thread
Deadite fucked around with this message at 14:11 on Sep 21, 2023 |
# ? Sep 21, 2023 14:05 |
|
Ended up just finding a better documented dev/packaging setup and piece by piece copied my entire app over. What a pain. But now I've got my first app Running Vite so that's fun.
|
# ? Sep 21, 2023 22:36 |
|
huhu posted:I built an Electron app like a year ago and knew my build process was poo poo. Wanted to redo it. I started here https://www.electronforge.io/guides/framework-integration/react-with-typescript and got a basic boilerplate Electron, react, webpack, and ts helloworld app(what my project is written in) up and working. Then I copied my old React app code and Electron app code over bit by bit until everything was working. Took maybe an hour or two. Had to fight with a few cryptic errors but they were all googleable. This almost got me everything I need in that I managed to get a typescript + electron/webpack + i write my code with ESM and not CJS, but I can't seem to figure out how to preserve this build path and also regular running it on the web without webpack at the same time. Is that something I should aspire to or should I lean 100% into webpack? The main reason I'm hesitant to go 100% webpack is I'm skeptical of the debugging experience of a webpack'd app.
|
# ? Sep 22, 2023 03:17 |
|
Vino posted:This almost got me everything I need in that I managed to get a typescript + electron/webpack + i write my code with ESM and not CJS, but I can't seem to figure out how to preserve this build path and also regular running it on the web without webpack at the same time. Is that something I should aspire to or should I lean 100% into webpack? The main reason I'm hesitant to go 100% webpack is I'm skeptical of the debugging experience of a webpack'd app.
|
# ? Sep 22, 2023 04:14 |
|
Finally I said gently caress it lets just see if I can get a working package of my app in electron and after some effort I did and I discovered that since webpack renames global variables and functions but misses some that I have stored in strings I cant use webpack. So I cant use electron with webpack and I cant use electron without webpack. So I think I cant use electron. Maybe there are some alternatives that try ti be less clever.
|
# ? Sep 22, 2023 09:45 |
|
If you have a dedicated webpack config, you can disable the minifier, which is the transformation step that messes with variable and function names. Maybe thatll help.
|
# ? Sep 22, 2023 09:52 |
|
Vino posted:but misses some that I have stored in strings Why are you storing variable/function names in strings? That's a pretty abnormal thing to do.
|
# ? Sep 22, 2023 13:34 |
|
It's a game with a lot of text and I have basically a simple text templating system that accesses game variables to do stuff like determine character genders. It's a bit hacky of course.
|
# ? Sep 22, 2023 20:42 |
|
You can reference a function itself without calling it, and then the mangling wont matter. Phone posting but I can edit an example in shortly edit: code:
necrotic fucked around with this message at 21:00 on Sep 22, 2023 |
# ? Sep 22, 2023 20:57 |
|
When I was using regular ES modules the problem was that "electron-forge start" was working fine but "electron-forge package" would produce a binary that wouldn't work properly. Finally I thought to myself, if the debug environment works OK then why don't i just copy everything out of node_modules/electron/dist and copy my game's web distribution both into a folder and have a batch script run electron with the command line parameter of my web distribution? Turns out that works. My app isn't terribly intensive so perf isn't a problem. It's hacky but I think it'll tide me over until electron has proper ESM support. Thanks for everyone who helped me, you're all sovereigns of gender unknown to me and deserving of crowns.
|
# ? Sep 23, 2023 20:19 |
|
i went through the pain of getting an electron+ts+import app running and also had some problems with debug working but release failing. it took me a whole loving day of fiddling with webpack and i hope i never have to do it again
|
# ? Sep 25, 2023 06:50 |
|
|
# ? May 16, 2024 07:31 |
|
go play outside Skyler posted:i went through the pain of getting an electron+ts+import app running and also had some problems with debug working but release failing. it took me a whole loving day of fiddling with webpack and i hope i never have to do it again
|
# ? Sep 25, 2023 13:35 |