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

370
Vistas
How to use svelte in an exising project?

I'm new to svelte and I'm trying to use it in my existing project following this tutorial. So in svelte's main.js I outputs css and js like this:

export default {
    input: 'src/main.js',
    output: {
        sourcemap: true,
        format: 'iife',
        name: 'app',
        file: '/path/to/myapp/static/js/svelte-bundle.js'
    },
    plugins: [
        svelte({
            compilerOptions: {
                // enable run-time checks when not in production
                dev: !production
            }
        }),
        // we'll extract any component CSS out into
        // a separate file - better for performance
        css({
            output: '/path/to/myapp/static/css/svelte-bundle.css'
        }),

However after npm run dev I get this error:

svelte-app@1.0.0 dev
rollup -c -w
rollup v2.56.3
bundles src/main.js → ../static/js/svelte-bundle.js...
[!] (plugin css) Error: The "fileName" or "name" properties of emitted files must be strings that are neither absolute nor relative paths, received "/path/to/myapp/static/css/svelte-bundle.css".
Error: The "fileName" or "name" properties of emitted files must be strings that are neither absolute nor relative paths, received "/path/to/myapp/static/css/svelte-bundle.css".
    at error (/path/to/myapp/svelte-components/node_modules/rollup/dist/shared/rollup.js:151:30)
    at FileEmitter.emitFile (/path/to/myapp/svelte-components/node_modules/rollup/dist/shared/rollup.js:13119:24)
    at Object.generateBundle (/path/to/myapp/svelte-components/node_modules/rollup-plugin-css-only/dist/index.cjs.js:84:12)
    at /path/to/myapp/svelte-components/node_modules/rollup/dist/shared/rollup.js:20218:25

I have also added the scripts to myapp's html:

<link href="/static/css/svelte-bundle.css" />
<script defer src="/static/js/svelte-bundle.js"></script>

Also in browser I get:

http://127.0.0.1:8080/static/svelte-bundle.js net::ERR_ABORTED 404 (Not Found)

Apprecite your help to fix this.

about 4 years ago · Juan Pablo Isaza
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