spierce7
12/17/2022, 10:30 PM<root project>/build/js
dir and putting it in the docker container.
The problem is that this folder contains EVERY single library that any project in my entire workspace touches. So my docker image is 400 MB, when it only needs to be 20 or 30 MB.
Is there any way to JUST package exactly the used dependencies?turansky
12/17/2022, 10:51 PMBuild only the server I want to packageOn this step you will install all NPM dependencies of your project
spierce7
12/17/2022, 10:58 PMturansky
12/17/2022, 11:03 PMjs
file and package.json
(in IR resulted file can be single) in separate folder
3. Run npm i
4. Pack folder in docker containerturansky
12/17/2022, 11:03 PMjs
filespierce7
12/17/2022, 11:05 PMspierce7
12/17/2022, 11:05 PMspierce7
12/17/2022, 11:08 PMturansky
12/17/2022, 11:13 PMEven though the IR compiler has the js files there locallyIt will be safety to build single JS file
spierce7
12/17/2022, 11:19 PMspierce7
12/18/2022, 3:46 AMspierce7
12/18/2022, 5:14 PMturansky
12/18/2022, 5:20 PMThe browser can do this with webpack, but how would I do this using a nodejs target?The same way 🙂
spierce7
12/18/2022, 5:21 PMturansky
12/18/2022, 5:21 PMkotlin.js.ir.output.granularity=whole-program
to build single JS fileturansky
12/18/2022, 5:23 PMWebpack is automatically applied to browser in kotlin. Is there a way for me to turn it on for nodejs?
browser
target for Kotlin/JS (to activate distribution) + node configuration for webpack (for valid globalThis
)spierce7
12/18/2022, 5:25 PMIt looks like the file this creates doesn't contain theCopy codekotlin.js.ir.output.granularity=whole-program
node_modules
dependencies.spierce7
12/18/2022, 5:26 PMI don't follow what you mean heretarget for Kotlin/JS (to activate distribution) + node configuration for webpack (for validbrowser
) (edited)globalThis
turansky
12/18/2022, 5:26 PMIt looks like the file this creates doesn’t contain theYes, it’s classic NodeJS distribution modedependencies.node_modules
turansky
12/18/2022, 5:28 PMI don’t follow what you mean here
kotlin.js {
browser {
commonWebpackConfig {
globalThis = "globals" // for node
}
}
}
spierce7
12/18/2022, 5:29 PMspierce7
12/19/2022, 7:33 AMgildor
12/19/2022, 7:41 AMturansky
12/19/2022, 2:30 PMturansky
12/19/2022, 2:30 PMspierce7
12/19/2022, 2:34 PMgildor
12/21/2022, 2:44 AMspierce7
12/21/2022, 6:12 PMspierce7
12/21/2022, 6:15 PMrequire
inside of the endpoint call and then use. This would yield the best times.
Currently this isn't reasonably possible with kotlin js unless you separate your code into an http module and a separate module for actually doing the logic of the endpoints. Even then, I'm not certain how it will workgildor
12/22/2022, 5:49 AMsupposedly the startup time is much worse for a single file, than lazily with many small files.Really curious how different it is without on demand modules loading