Kotlin/JS a style from the npm package

Hello everyone!

I created a simple project https://gitlab.com/keverywhere/kweb-javascript-npm to learn how to use Kotlin / JS with a npm package.

As a npm package was selected “awesome-notifications” https://www.npmjs.com/package/awesome-notifications


  1. Create the Kotlin / JS Browser project
  2. Append the npm dependency implementation (npm (" awesome-notifications "," 3.1.0 "))
  3. Write a tiny wrapper
  4. Call the wrapper method

But the notification toast appear without a style.

Could you say me, what need to do to append style from npm dependency in the project?

If I manually create the style.css with content from the npm style file, notification will work as expected.

1 Like

See the rply to this kotlin discussion questiuon

Thank you!

Steps that solved my problem:

  1. Add dependencies to build.gradle.kts file
implementation(npm("awesome-notifications", "3.1.0"))
implementation(npm("css-loader", "3.4.2"))
implementation(npm("style-loader", "1.1.3"))
  1. Create file {project_root}/webpack.config.d/css.js
    test: /\.css$/,
    loader: 'style-loader!css-loader'
  1. Modify the entry point:
import kotlinext.js.require

fun main() {
    // ...