Okay, I am running in quite some issues with a
binaries.library
project which I want to include in a React project. I have tried it 3 ways and only 1 works and I have no clue why. My feeling is that it is related to the
INSANE JS module system. I would really appreciate some input. I have made a minimal reproduceable project for the 3 situations:
1.
NPM + Create React App: This one works! Including source map support. However, CRA is deprecated and NPM is slow..... (
https://github.com/avwie/kotlinx/tree/npm-webpack-cra). Just run
npm run dev
.
2.
NPM + Vite Create React: This one results in
"useTodoViewModel" is not exported by "../build/js/packages/architecture-demo/kotlin/architecture-demo.js", imported by "src/main.tsx"
(
https://github.com/avwie/kotlinx/tree/npm-vite). Also run
npm run dev
3.
PNPM + Vite Create React: This one works, but source map support isn't working. They are not resolvable and cause 404. Having source-map support is critical for development. I
think it is related with how PNPM works (a central store). (
https://github.com/avwie/kotlinx/tree/pnpm-vite), and run
pnpm run dev
I hope there are people who know how I can get nr.3 to work?