Questions tagged [vite]

For questions about using Vite, a two-part build tool (dev server + build command) that aims to provide a faster and leaner development experience for modern web projects.

4741 questions
20
votes
4 answers

vite without hash in filename

I'm trying to compile a webcomponent based on the monaco editor (in a lit element context). Having tried a lot of options I now have got the result down to two files rmx-monaco.abc123.js style.css My top priority is to get rid of the hash…
Simon H
  • 20,332
  • 14
  • 71
  • 128
19
votes
3 answers

vite: how to handle "require" statement in third-party module?

I use an UI library which has "require" statement. I can use vite to run development mode successfully. but when I build and preview the dist, the browser fail: Uncaught ReferenceError: require is not defined, because there are some "require"…
philo
  • 502
  • 1
  • 4
  • 13
18
votes
16 answers

Vite manifest not found

I Working on project that working with laravel 9 and Vite with laravel-vite, In Dev environment all thing working fine, but in production cPanel server I has this issue Vite manifest not found at:…
sos5020
  • 379
  • 1
  • 3
  • 10
18
votes
4 answers

Vue test utils for Vue3 : document is not defined

I try to bootstrap a simple app based on the following Vue3, Vite, Vitest I also installed the vue 3 compatible version of vue test utils to test vue components. I have an error trying to replicate the basic example in the docs : import { mount }…
Pierre_T
  • 1,094
  • 12
  • 29
18
votes
3 answers

How to set vite (preview) production port?

I have been looking arround on how to set a production port for vite but I can't find way I have tried this vite js config server: { host: true, }, preview:{ port:5005 } but it seems like it can't work
17
votes
11 answers

504 (Outdated Optimize Dep) while using react-vite

I installed a package called big decimal js while using React with JavaScript on Vite. On compiling, it showed the following error on the console, and the application did not load: My package.json: { "name": "settleup", "private": true, …
Vedant Shah
  • 557
  • 1
  • 4
  • 15
17
votes
2 answers

Slow Vite startup

Recently I started a new project in React v18 which uses Vite v4.1.1 as a build tool. After installing a few libraries the initial load of the app (after running npm run dev) takes several minutes even though the Vite itself starts within a few…
17
votes
1 answer

How to extract css as a separate .css file in Vite?

In webpack it is possible to generate output in such a way: 1 file with bundled js code 1 file with bundled css This is part of the webpack config, that results in such output: const MiniCssExtractPlugin =…
Daniel
  • 1,431
  • 2
  • 16
  • 36
17
votes
19 answers

Vite Server is running but not working on localhost

Vite + Reactjs server is running but I am getting "This localhost page can’t be found No webpage was found for the web address: https://localhost:4200/" on the browser
Muhammad Raheel
  • 617
  • 1
  • 6
  • 15
17
votes
1 answer

How to include CSS from node_modules in Vite in production?

I have a typescript web application that includes CSS files from its NPM dependencies in index.html like this: After I added vite to my project, this works in…
Konrad Höffner
  • 11,100
  • 16
  • 60
  • 118
17
votes
2 answers

vite cannot handle xxx.html files

I had a Vite project for Vue2, It include a static html file. like following import template from 'editor.html'; export default { template: template } When I ran yarn dev, Terminal…
noahlam
  • 171
  • 1
  • 4
17
votes
1 answer

In Vite2, How to import an ESModule in tailwind.config.js

Building a Vite2 app. tried to import an ESModule in tailwind.config.js. The Module was exported like: export default xxx; Then I imported the module in tailwind.config.js like: const xx = require('./xx/xxx'); But I got an Error: [plugin:vite:css]…
Shook Lyngs
  • 1,093
  • 2
  • 10
  • 19
16
votes
0 answers

TypeError: a.default.detectStore(...) is undefined

After initiating a new Vite React App in javascript from npm. npm create vite@latest and after installing the default modules npm install I came across 2 moderate severity vulnerabilities that I tried to ignore. enter image description here Then…
keanu.b
  • 403
  • 5
  • 14
16
votes
8 answers

net::ERR_CONNECTION_REFUSED using Laravel 9, ReactJs with vite js

I'm trying to build an app using Laravel 9 and ReactJS with vite js. I tried following command to build. npm run dev But I'm getting following errors, GET http://[::1]:5173/resources/css/app.css net::ERR_CONNECTION_REFUSED GET…
Sourav Das
  • 527
  • 2
  • 5
  • 13
16
votes
7 answers

I can't run 'npm run dev' since Laravel updated with Vite

Taylor Otwell announced that new Laravel projects now will run with Vite and that Vite is installed by default. I can't seem to be able to run dev environment npm run dev I installed new laravel project, installed Laravel JetStream with SSR and…
Mostafa Said
  • 739
  • 2
  • 6
  • 20