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.
Questions tagged [vite]
4741 questions
1
vote
0 answers
Sass Error while building a React + Typescript + Vite project for production
I was building my React Vite website using npm run build but it gave me this error:
error during build:
Error: expected "{".
╷
2 │ for (var i = 0; i < m.length; i++) {
│ ^
╵
stdin 2:19 root stylesheet
at…

Aditya Jaiswal
- 11
- 1
1
vote
1 answer
How can define meta in vite-plugin-pages?
I have some routes and looking for to have access a value through defining meta. And,i also should say i used Vite-plugin-pages for routing in Vue 3.
I read the plugin documentray, and add a route with yaml format as follows:

amir tbi
- 320
- 2
- 14
1
vote
1 answer
How to make an offline PWA with Qwik Framework?
This is what I get when I disable my PWA connection.
I'm breaking my head trying to get my PWA developed with Qwik framework to work offline. I've read the documentation, looked for examples, tried Vite-PWA and a manual service-worker registration…

Alessandro Rios
- 11
- 4
1
vote
1 answer
Tailwind lg breakpoint not working after deploy but fine locally
When running my current Astro.build project locally using astro dev, styling works as expected.
After building and deploying the site though – either with astro build and astro preview or live on cloudflare pages – the lg breakpoint does not…

J Heschl
- 177
- 4
- 15
1
vote
0 answers
How to auto-import declarations.d.ts in vite/unplugin-auto-import?
I'm trying to auto-import src/declarations.d.ts into my vue components but can't get it to work. This is my vite.config.ts:
import { fileURLToPath, URL } from 'url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import…

Artur Müller Romanov
- 4,417
- 10
- 73
- 132
1
vote
0 answers
is it possible to split the react dom package when using vite
Now I am using vite "vite": "^4.3.2" to build the react project, split the chunks in vite like this:
export default defineConfig({
plugins: [react()],
build: {
outDir: "build",
rollupOptions: {
output: {
manualChunks(id){
…

Dolphin
- 29,069
- 61
- 260
- 539
1
vote
1 answer
How to use Markdoc in React + TypeScript + Vite app
Document.tsx
import React from "react";
import Markdoc from "@markdoc/markdoc";
const config = {};
interface DocumentProps {
source: string;
}
export function Document({ source }: DocumentProps) {
const ast = Markdoc.parse(source);
…

tedchow
- 105
- 1
- 6
1
vote
0 answers
How to do manual mocks in Vitest?
I'm basically trying to mock an external module in the same way for all my vitest tests, and it's surprisingly not trivial. In Jest, I would just create a __mocks__ folder at the root, and it appears vitest is maybe supposed to support this, but I…

Daniel Geisz
- 11
- 1
1
vote
2 answers
Uncaught TypeError: styled_default is not a function at Grid2.js:5:26
I am having problem with material ui library when I try to run react with vite.enter image description hereenter image description hereenter image description here
I tried deleting and reinstalling the node_modules folder several times. But it…

Shahzod Ziyodullayev
- 21
- 1
1
vote
1 answer
Vite: problem loading assets from node_modules in third party libraries
I move from CRA to Vite.
I am using an external component library that is using some internal assets (images and fonts). Before moving from CRA everything was working fine, but now Vite is not loading the images in development mode.
I'm getting 404…

hjaraba
- 21
- 4
1
vote
2 answers
How do I correctly (and securely) set environment variables for an Azure SWA-hosted React.js website (frontend-only; no backend)?
My setup is Vite-based development environment with React.js framework; GitHub Actions for CI/CD.
I can pass my environment variables into my app without an issue. But, in the event that I run a build of my web app and push that to GitHub (Actions)…

jcomp_03
- 127
- 1
- 8
1
vote
0 answers
Astro JS site builder: Include worker (or other companion library) in build
I'm building a web app that relies heavily on a background Worker
Background workers are essentially little companion libraries that you write that are loaded separately from the rest of the application JS. Here's how I successfully load a worker in…

chadoh
- 4,343
- 6
- 39
- 64
1
vote
1 answer
New TypeScript React app using Vite - JSX.IntrinsicElements errors
I'm trying out Vite with React TS and using their official documentation. The app builds and runs, however viewing it in VS Code shows a whole bunch of Property 'div' does not exist on type 'JSX.IntrinsicElements'.ts(2339) errors.
I've created a new…

Web Dev
- 2,677
- 2
- 30
- 41
1
vote
2 answers
Phaser3: Vercel deploy fail (updated)
I using Vite + React + Typescript, and use Vercel for deployment. In my localhost build or preview are working fine.
11:57:49.482 error TS2688: Cannot find type definition file for 'Phaser
11:57:49.482 The file is in the program…

FeelRightz
- 2,777
- 2
- 38
- 73
1
vote
0 answers
Getting "default is not exported by svg" error when bundling with rollup and svgr
I started an app with vite, and I'm having some trouble bundling it with rollup.
Running yarn rollup -c gives me the following error:
[!] RollupError: "default" is not exported by "src/assets/svg/basic_icons/Atom.svg", imported by…

hmrbcnt
- 93
- 6