> With webpack I use `@JsModule("/kotlin/css/st...
# opensavvy
c
With webpack I use
@JsModule("/kotlin/css/style.css")
but with Vite I need
@JsModule("/css/style.css")
.
I think so. It's this issue, if you want to follow it. I'll increase its priority. https://gitlab.com/opensavvy/automation/kotlin-vite/-/issues/39
r
I added a comment about the incompatible paths.
🙏 1
I've played a bit with the sources and I'm afraid this will not be an easy fix. For some incomprehensible reason KGP copies all destination .mjs files and project resources to the same directory (don't try to put
kotlin-kotlin-stdlib.mjs
file into your resources 😉). Webpack is executed one level up so
kotlin/*
paths are working fine. But Vite needs
root
directory with both
index.html
and
project.mjs
, so even if you execute Vite in different directory it won't help with paths.
For my personal requirement of webpack compatibility I can customize webpack configuration and use
./
path prefixes, which work for both webpack and vite. You need to decide whether the need for compatibility is important for your project.
c
I see
Do you know if there is a task that is just the output of the KotlinJS compiler (.mjs files) and nothing else? I could hook up the resource files myself and place them wherever
r
You could try
compileDevelopmentExecutableKotlinJs
c
What do you think would be the best file structure?
Copy code
workingDir/
  vite.config.js
  index.html
  <other resources>
  kotlin/
    <all source code>
? But that might cause other problems in the way code refers to resources.
r
I think so as well. I think KGP keeps this in the same directory for a reason, even if I don't understand the details.
c
I wish the KotlinJS compiler was more configurable when it comes to paths. The fix using the new copy broke source maps again 😕