search

Home  >  Q&A  >  body text

Speeding up the ViteJs development model: Vue 3

Can someone help me speed up my ViteJs server?

The problem is that the server is very slow in development mode. I start the server, then launch the page in the browser and wait 3-6 minutes for the page to load! Initially, ViteJs downloads a few kilobytes of the resource and then the request is in "pending" status for 2-3 minutes.

Then it will start loading all resources every time. Although I also specified in the config that all css should be local.

Page reloading is also very slow.

I started the project like this:

vite

This is my configuration:

import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
import {resolve} from 'path'

export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      "@": resolve(__dirname, "./src"),
    },
  },
  publicDir: 'public',
  server: {
    port: 8080,
    watch: {
      usePolling: true,
      ignored: ['!**/bundle/**', '!**/lib/**']
    }
  },
  css: {
    modules: {
      scopeBehaviour: "local"
    }
  },
  preview: {
    port: 8080,
  }
})


P粉953231781P粉953231781418 days ago838

reply all(1)I'll reply

  • P粉037880905

    P粉0378809052023-11-01 11:14:05

    Wow, the problem is in WSL2! Just tried booting vite from Windows out of interest. Start page loads in 1 second! I think I solved my problem myself! Thanks!

    reply
    0
  • Cancelreply