Describing js lib by using external

I am trying to learn, how to create a kotlin library. I know how create a library that is written on kotlin. I created a simple test project. that has only one js file and one kotlin file. Js file contains one function, kotlin file contains a header for this function with external prefix. When I create a library from such project ( like it is described in kotlin tutorials) it all works fine. But if I am using some js library, and trying to creat kotlin descriptions of this library, it doesn’t work. I’ve completely stuck with it. I don’t know javaScript at all, so maybe that is why I can’t understand the cases when I should use @JsModule and other things like that. For example - I picked pixi.js library. I put it into my libraryProject in a directory, that is marked as Resources Root. In src directory I create kotlin file Point.kt, that contains the description of Point class in js library. I describe it as
external class Point(x:Number, y:Number)…
I create an artifact from built project, and in other project I try to use it as a library. But I get an error -
Uncaught ReferenceError: module is not defined
Maybe I should use in description Point.kt file something like @file:JsModule(…) but I absolutely can’t understand how, why, and with what parameters.

I understand that probably my question is odd or stupid, maybe you have some suggestions what I have to read about before even creating libraries, I’ve read all topics that official kotlin documentations offers about JS with kotlin. Maybe I missed something, or didn’t understand. Will be glad to hear any advices.

I would like to know the answer too, how to import simple js file to be compiled along the kotlin file within IntelliJ.

Solution for me now is to import the js file in the html page, from separate directory (just like you would when using notepad to create javascript file). Kotlin compiler knows nothing about this, but by using the extern keyword, you can have it “blindly” inside your Kotlin project for use. So in the end the javascript file is available, but not at compile time.