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

468
Visualizações
Svelte only supports es6+ syntax. Set your 'compilerOptions.target' to 'es6' or higher

I have been using Svelte, TypeScript and Rollup (letting TypeScript handle the transpilation) to target ES7. Now I'm starting a new project and need to target ES5.

The first thing I have noticed is that everything gets transpiled but the components are still classes. I didn't have any scripts in the components at that point. Once I added a script tag to .svelte file, I immediately got the error:

Svelte only supports es6+ syntax. Set your 'compilerOptions.target' to 'es6' or higher

I understand that I will need to set TS target to ES6/ES7 and install Rollup Babel plugin to handle the transpilation to ES5. But why would plain TypeScript transpilation not work? Why does Svelte care about TypeScript target? You'd think that Svelte files get converted to TS before being transpiled to ES5, but it seems like it's the other way around?

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

0

The Svelte compiler operates on JS, any other language is pre-processed to turn into JS, otherwise the Svelte compiler would have to deal with many different languages. Also, you cannot just turn JS into TS, TS has more information that JS, there is no way to get that information back.

If your end-result should be ES5 you probably need a multi-step pileline:

TS => JS 6+ =Svelte=> JS 6+ => JS 5
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