Importing css without require

Thanks for the response.

I already have cssSupport enabled. This however simply provides defaults which I can alternately do manually using a js file in the webpack.config.d directory.

This logic thought helps resolve import statement (or require in Kotlin). It does not help me when I have no observable method / location I can place a require statement.

If for example, I import the react-bootstrap NPM dependency in this module, then have a single file as.

@file:JsModule("react-bootstrap")
@file:JsNonModule

package me.local.bootstrap.alerts

import react.*

@JsName("Alert")
external val bootstrapAlert: RClass<AlertProps>

external interface AlertProps: RProps {
    var variant: String
    var dismissible: Boolean
    var show: Boolean
    var onClose: (a: Any, b: Any) -> Unit
    var closeLabel: String
}

I can consume this in another module e.g.

bootstrapAlert {
    variant = "warning"
    +"Sample alert"
}

However, at no point is the precompiled CSS been made available.

As noted, I can require it were I consume bootstrapAlert, but I want to require it within the module providing bootstrapAlert.

Because of the minimal boilerplate provided in the module, require is disallowed as I cannot mix non-external declaration in files marked JsModule. I can’t mark it external because externals cannot have values assigned at the point they are defined.

Overall, because I cannot call require, I cannot trigger an import that will match the cssSupport rules.