Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

234
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!