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

368
Visualizações
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 à 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