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

273
Visualizações
Change output structure in Vite

I am new to Vite and I have a feeling that I am missing something. I am trying to export files to their own directory, but I messed up and don't understand how to do it right.

The src folder looks like this:

my-app/
├─ node_modules/
├─ src/
│  ├─ fonts/
│  ├─ html/
│  ├─ images/
│  ├─ js/
│  ├─ static/
│  ├─ styles/
├─ package.json
├─ vite.config.js

I expect it to copy that, and so it does, but it does these "extra" things I can figure out why:

  1. There is an assets map, with some JS in it.
  2. Everything in the fonts folder is not only in the font folder, but all files are also copied to the export root.
  3. The same counts for "some" images, they are copied to the root. The strange part is that it are only a couple of images svg's only, but not all svg's.
  4. My CSS and JS files are copied to the root, not to the directories I'd like them in. I guess this is a setting. So js/app.js and css/app.css

My JS Vite.config.js

import { defineConfig } from 'vite';
export default defineConfig({
  publicDir: 'assets/',
  build: {
    emptyOutDir: true,
    outDir: '../../testproject/assets/test/',
    rollupOptions: {
      output: {
        entryFileNames: `[name].js`,
        assetFileNames: `[name].[ext]`,
      },
      input: [
        './src/js/app.js',
        './src/styles/app.scss',
      ],
    },
  },
});

Am I completely missing some settings file? I tried to reinstall in a different folder, but it does the same thing everywhere. Any idea how I can get things right?

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