I have a small wrapping Problem. I try to wrap <ht...
# javascript
h
I have a small wrapping Problem. I try to wrap https://github.com/AxaFrance/oidc-client/tree/main/packages/react-oidc. It looked rather straight forward, as far as I can see it's just:
Copy code
package shared.utils.reactOdic

@JsModule("@axa-fr/react-oidc")
@JsNonModule
external val OidcProvider: react.FC<OidcProviderProps>

external interface OidcProviderProps : PropsWithChildren {
    var configuration: OidcConfiguration
    // all the other fields
}

external interface OidcConfiguration {
    var client_id: String
    // all the other fields.
}
Then I tried to use it:
Copy code
val App = FC<Props> {
    OidcProvider {
        configuration = oidcConfig
        RouterProvider { router = mainRouter }
        ReactQueryDevtools { initialIsOpen = false }
    }
}
But I get
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
When I do
OidcProvier.create { /* *config & browser* */ }
there is no error, but also no dom changes/empty site.
t
You need
@JsModule
on file level
h
Hey, thank you for your answer. I actually tried that before, but got the error that both
@JsModule
and
@JsNonModule
are required.
@JsNonModule
was will in without the
file
level declaration, so for some weird reason it didn't occur to me to put the
@JsNonModule
also on the file level. Thanks everything works now. ❤️
t
Please use
target = "es2015"
And remove redundant
@JsNonModule
h
I added it to
Copy code
js("jsFrontend", IR) {
    compilerOptions {
        target = "es2015"
        freeCompilerArgs.add("-Xcontext-receivers")
    }
}
But now I get hundreds of these errors:
Copy code
Module not found: Error: Can't resolve '@mui/material/CardActions' in 'path'
Did you mean 'index.js'?
BREAKING CHANGE: The request '@mui/material/CardActions' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
t
cc @Michael Porotkin
h
I tried invalidating Caches, sadly it didn't help. The error seems to come from
:jsFrontend:jsFrontendBrowserProductionWebpack
m
Hi, @Hildebrandt Tobias Try adding this to your Webpack config
Copy code
config.module.rules.push({
  test: /\.m?js$/i,
  resolve: {
    fullySpecified: false,
  },
})
h
Oh yeah, that worked. Much obliged. 🙏
🚀 1