I'm creating a Tauri app that uses Fable to compile F# to JS. And I want to use Svelte with it, too. So far, I have compiled my F# file to a .js
file. I've created a .svelte
file with the following contents (named App.svelte
)
<script>
import './App.fs.js'
</script>
<main>
<p>{msg}</p>
</main>
<style></style>
My index.html
:
<body>
<script src="main.mjs"></script>
</body>
And my main.mjs
:
import App from './App.svelte';
const app = new App({
target: document.body,
props: {
name: 'world'
}
});
export default app;
I run the program with npm run build
. This compiles my F# files and they become ready.
I run npm run tauri build -- --debug
to compile my whole Tauri app and open it.
I do this, and nothing shows on screen. But when I look at the console, it says main.mjs
cannot import.
Supposedly, I need to compile the Svelte files. But Svelte uses rollup
and I think I need to use webpack
to be compatible with Fable or Tauri.
All these files are in project/src
.
I need to compile and use a Svelte file in an index.html