The biggest change for this release is that it correctly integrates webpack into the dev build, which means you can use npm dependencies now 🎉 .
This is a fix I avoided for a while, because the official webpack task would generate stale outputs when run in continue (i.e. live reloading) mode. We've hacked around it for now, but you can follow the related youtrack issue if you want to see if a real fix ever makes it down the pipeline.
This change will require some minor migration steps for legacy projects, which are discussed at the bottom of this release.
But first, the features and fixes!
Frontend
- Fixed the drag and drop
Modifier.onDropmodifier, which was broken. - Added missing
[user-select](https://developer.mozilla.org/en-US/docs/Web/CSS/user-select)values. - Added a
slugparameter to thePageContextclass.
Silk
- Updated tooltips so you can put newlines in their text now.
Icons
- Added the ability to configure sizes for Font Awesome icons.
Gradle
- Added support for webpack when using the
kobweb runcommand. - Expose a
Project.kobwebBuildTargetvalue that users can use in their own build scripts to see if Kobweb is targetting a DEBUG or RELEASE build. - Kobweb applications no longer force "whole-program" granularity. However, you may want to experiment adding it back, as for some projects, it can result is a smaller final binary size.
- To do this, add
kotlin.js.ir.output.granularity=whole-programto your project'sgradle.propertiesfile.
- To do this, add
Templates
- All templates have been updated to take advantage of the webpack changes.
- The
siteandsite/emptytemplates have been renamed toappandapp/emptysince they now have asitesubfolder in them, andsite/sitelooks funny. - The
appandapp/emptytemplates now put their Kobweb code into a submodule instead of at the root of the project.- While slightly more complex than a simple project with no submodules, this is a more realistic layout in most projects. It makes it trivial, for example, to add other submodules (e.g. libraries or other multiplatform app)
Migration Steps
If you are updating a legacy project to v0.11.6, you should be aware that your Kobweb configuration (.kobweb/conf.yaml) will be pointing at the wrong dev script location.
If you don't change it, you will try to run your web app and it will fail to load, leaving you with a blank screen. If you look at the page's console, you'll see an error message talking about not being able to load a module due to missing dependencies.
There are two issues with that JS file:
- It doesn't get transformed by Webpack, which is important if you want to use any
npmdependencies in your project. - The Kobweb Gradle plugin no longer forces "whole-program" granularity, so the file you're pointing at will no longer be a monolithic one, missing its dependencies.
To fix this, you can do either of these steps:
- (Preferred) Change your
.kobweb/conf.yamldev script value to point at the Webpack output location.
Before:
server:
files:
dev:
script: "build/js/packages/example/kotlin/example.js"After:
server:
files:
dev:
script: "build/developmentExecutable/example.js"- (If you know what you're doing) Explicitly set your project to whole-program granularity, by adding the following to your project's
gradle.properties:
kotlin.js.ir.output.granularity=whole-programYou can read more about granularity at the official docs.
Note that you can do both of these steps. You can experiment with whole-program (or per-module, the default) granularity to see if it affects the size of the final JS code that gets generated from a kobweb export.