Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

408
Vistas
How to Compile a Svelte file to JavaScript from the Command line?

I'm new to Svelte. Quick question:

Is there a CLI for the Svelte compiler, and how do I access it?

I understand Svelte has a preconfigured setup that uses rollup and what not for building an app. That's all good, but I only need the CLI for transforming a svelte file to pure js file. Something like:

svelte compile input.svelte --out=out.js

Update It seems like there is no CLI for the Svelte compiler. However, a brief outline of the compilation process is available here. In particular,the following code snippet, which can be used to build CLI.

result: {
    js,
    css,
    ast,
    warnings,
    vars,
    stats
} = svelte.compile(source: string, options?: {...})
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

For Svelte 3 there is no official CLI.

You'll either write one:

#!/usr/bin/env node
import { compile } from "svelte/compiler";

const filename = process.argv[2];
const result = compile(filename, { filename });
process.stdout.write(result.js.code);

and customize that one to your exact needs.

But most cases an existing build tool is a better option
and for most build tools there is plugin or loader available for Svelte.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda