Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

268
Visualizações
Using Svelte, Fable and Tauri

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

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

💡 You should give us a reproducible example to show us how you configured your project and what you've tried to get it working.


👉 I give you here in this answer a working example to study, more than answering your question as it miss a lot of details about your setup.

Basically, to npm run tauri build your app, you will want to configure your project in order to build the Fable code, then Svelte code and then bundle everything with Tauri.

Also, you are not required to use webpack. Rollup is good.

hint: if you really need webpack for some reason, just run it run it before rollup and you will find webpack svelte-loader on github

I published a working template project to answer your question that you could use/study to check what you are missing. It was just created by following this flow:

  • Project: https://github.com/flydev-fr/fable-svelte-tauri-app
  1. create the Svelte app yarn create svelte-app
  2. create the Tauri app yarn create tauri-app
  3. create the Fable app
dotnet new --install Fable.Template
dotnet new fable

Then after that, it's just a mater of combining / merging everything, and adding Tauri to the Svelte app. Please check the project to see how I configured it

If you have more precise question, please make another question.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda