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

235
Visualizações
How do I remove vue spec files from vite config

I've succesfully added vite to my project. It builds fine for prodiction. However in Production I have an error

Uncaught ReferenceError: describe is not defined at index.ba9d79ff.js:1119:1426

I then saw the my .spec files where being added. I thought vite would of handled the removal of the test files. I want to remove my .spec files from production. but not having such luck. I'm using Vue 2 with vite. I added

production: {
 exclude: ['src/components/**/*.{spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}']
},

but the files are still being added. Is there something more I need to do?

My config

import { defineConfig } from "vite";
import { createVuePlugin as vue } from "vite-plugin-vue2";
import { VuetifyResolver } from "unplugin-vue-components/resolvers";
import Components from "unplugin-vue-components/vite";

// https://vitejs.dev/config/const
const path = require("path");
export default defineConfig({
  plugins: [
    vue(),
    Components({
      resolvers: [
        // Vuetify
        VuetifyResolver(),
      ],
    }),
  ],
  resolve: {
    extensions: [
      ".mjs",
      ".js",
      ".ts",
      ".jsx",
      ".tsx",
      ".json",
      ".vue",
      ".scss",
    ],
    alias: {
      "@": path.resolve(__dirname, "./src"),
      json2csv: "json2csv/dist/json2csv.umd.js",
      "~bootstrap": "bootstrap",
    },
  },
  production: {
    exclude: ['src/components/**/*.{spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}']
  },
  extensions: etc,
  css: {
    preprocessorOptions: {
      scss: {
        //  additionalData: `@import "src/scss/app.scss";`,
        // additionalData: `@import "src/scss/_variables.scss";`,
        sourceMap: false,
        additionalData(source, fp) {
          // All scss files ending with imports.scss
          // will not re-import additionalData
          if (fp.endsWith("_variables.scss")) return source;
          // Use additionalData from legacy nuxt scss options
          // return `@import "@/assets/mixin.scss"; ${source}`;
          return `@import "src/scss/_variables.scss"; ${source}`;
        },
      },
    },
  },
  server: {
    port: 8090,
  },
});
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