Ahmed Riyadh
05/01/2024, 6:44 PMWebpack
work in Kobweb
or even Kotlin/JS
But when using libraries, it's better to install them using npm
package manager and import only the things you need from the package/library to reduce the production bundle size and make the app faster, I tried Webpack
in Vanilla JS
projects and in React/Next js
but I'm not how it work in Kotlin/JS
target, I see most Kotlin
developers import the full css and js using public CDN instead of using npm
and import something only the things you need, but why? does this method have any downsides that doesn't exist on normal JS projects?CLOVIS
05/01/2024, 8:07 PMimport './@material/web/button/test-button.js'
In JS, this would be an import at the top of the file. But Kotlin only allows importing Kotlin files, so if you want to import a JS or CSS file, you use this function instead.
(now, I don't know this project, so maybe the require
function is different there)CLOVIS
05/01/2024, 8:07 PMCLOVIS
05/01/2024, 8:08 PM