8 Dec 2023 |
armanbilge | try removing this https://github.com/windymelt/aws-lambda-scala-js-exercise/blob/7569375c397d904813dda8a919c8a7427d0e2e97/build.sbt#L16 | 17:42:15 |
armanbilge | I don't think it's compatible with what you are doing | 17:42:20 |
armanbilge | also I see you are adding an AWS crypto dependency | 17:42:50 |
armanbilge | firstly, are you sure you need to bundle it? I don't know what JS libraries are available by default in JS lambdas | 17:43:11 |
armanbilge | secondly, I would strongly recommend avoiding JS dependencies and just using Scala alternatives | 17:43:24 |
armanbilge | for example, look at the smithy4s project which has good support for calling AWS APIs, and has already implemented the necessary cryptography support | 17:43:46 |
armanbilge | https://disneystreaming.github.io/smithy4s/ | 17:44:02 |
armanbilge | * https://disneystreaming.github.io/smithy4s/docs/protocols/aws/aws | 17:44:30 |
windymelt | ah, I was going to just demonstrate that we can use npm libraries in Scala.js. | 17:45:11 |
armanbilge | does it have to be in a lambda? 😄 | 17:45:44 |
armanbilge | anyway, personally I don't recommend that. we have very good support for pure Scala libraries on Node.js | 17:46:03 |
windymelt | Of course, there are many good pure libraries for Scala.js. But I think it is still important to interop/bundle npm library in industrial use case. Sometimes we cannot get Scala.js support for some libraries... | 17:49:32 |
windymelt | (@aws-crypto/sha256-js is just example) | 17:50:09 |
armanbilge | well, the key word here is "bundling" | 17:50:12 |
armanbilge | depending on how you are deploying it, you may or may not need to bundle | 17:50:24 |
armanbilge | for example, if you are publishing it as a CLI tool to npm, you don't need to bundle | 17:50:40 |
armanbilge | I guess this is my follow-up advice 😄 | 17:51:12 |
armanbilge | if you insist to use npm dependencies, don't bundle them unless you have to | 17:51:21 |
armanbilge | it's perfectly fine to use them out of the node_modules/ directory | 17:51:33 |
armanbilge | pretty sure you can do a similar thing with lambda | 17:52:09 |
windymelt | Thank you, I'll try isolating node_modules/ to care about libraries. 🥰 | 17:55:37 |
armanbilge | if you run npm i @aws-crypto/sha256-js it will install in a node_modules/ and node will automatically pick it up | 17:56:51 |
| leafywind2 joined the room. | 18:00:06 |
| paava007 joined the room. | 19:04:26 |
9 Dec 2023 |
unarist | scalajs-bundler only supports fastOptJS/fullOptJS, which only accepts single module from fastLinkJS/fullLinkJS. So it is not compatible with ModuleSplitStyle.SmallModulesFor() . | 07:17:17 |
| unarist | 07:17:18 |
unarist | Hmm, my private project also uses webpack to deploy lambda function but I'm not sure why 🤔 Maybe I can deploy it with only zipping node_modules . | 07:32:15 |
| jeengbe joined the room. | 13:31:03 |
10 Dec 2023 |
| lmlynik | 10:34:12 |
| axyolotl changed their display name from ekhx#0 to axyolotl. | 17:55:50 |