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
1
vote
0 answers

Rollup.js exclude some files from bundling

I am using Vue together with TypeScript and Vite. Inside the code I use a constant for the API-URL. My goal is to bundle the application but keep my config.ts (or .js) file "as-is" for it to be comfortably customizable after build. Is this…
dasdawidt
  • 13
  • 5
1
vote
0 answers

Vite, Elastic UI: Failing to dynamically import icons for EuiIcon

https://github.com/rorymcd98/spot-the-image-gen Here's my repo. To install simply do: yarn install yarn dev The issue that I'm having is with Elastic UI's EuiIcon in the ./src/components/Counters.tsx. I'm trying to import shard and bullseye type…
Rory McDonald
  • 253
  • 2
  • 8
1
vote
0 answers

How to test that a form was submited with react-hook-form and vitest

I have a very simple form in which i try to test that once the submit button is hit the mock function is called, but to no success, It works when i test that the input was changed, but clicking the button doesn't submit the button here is the code …
CinemaClub
  • 69
  • 6
1
vote
1 answer

[vite]: Rollup failed to resolve import "image" from

having an issue with my Vue 3 Vuetify SPA. I can run npm run dev just fine, and it loads assets, but when I run npm run build it fails to build with the error ✓ built in 3.25s [vite]: Rollup failed to resolve import "image" from…
Zach Handley
  • 914
  • 1
  • 12
  • 25
1
vote
1 answer

Vue3/Vite: module has been externalized

I'm trying to use crypto to hash strings in a Vue 3 app. async function hash (token) { const data = new TextEncoder().encode(token) const byteHash = await crypto.subtle.digest("SHA-256", data) // ^ the below…
Fred
  • 1,103
  • 2
  • 14
  • 35
1
vote
0 answers

How to make Vite output "main.js", not "main.jsx" in development?

I am trying to integrate Vite (React) with my Flask backend. I am following the docs: https://vitejs.dev/guide/backend-integration.html and understand how it should be done for production, but have some problems in dev setup. Namely, the docs say to…
barciewicz
  • 3,511
  • 6
  • 32
  • 72
1
vote
1 answer

Vite React app working in dev mode but not building

I have a React app with Vite and TypeScript that works just fine in dev mode. However, if I try to build the app, I get the error: [commonjs--resolver] Unexpected token (9:4) in C:/···/node_modules/typedarray-pool/pool.js file:…
1
vote
0 answers

CRA to Vite trying to deploy to Heroku - error "{}-cache" is imported by " - blank page

Our app run react for the front-end and we are trying to move away from Create React App and use Vite. Locally everything is working just fine but when pushing to Heroku we have the following error in the console and our app is just a blank page. We…
1
vote
0 answers

Vite: How to speed up build with large dependency?

I'm developing a chrome extension so I need to use vite build and can't use vite dev. I'm trying to use the monaco-editor. Even when I'm careful to only use a minimal monaco setup, build time increases from a nice 0.6s to annoying 5.6s. Is there any…
Peter V. Mørch
  • 13,830
  • 8
  • 69
  • 103
1
vote
1 answer

renaming main.jsx to index.jsx in a React project initialized with Vite

I learned react with the old "create-react-app" way of initializing a new project. I recently came across Vite and decided to switch. One of the differences in file structure that I noticed is that instead of creating index.js, Vite uses…
Aslan
  • 27
  • 5
1
vote
0 answers

Vite JS React run build on ubuntu

I'm trying to run a dist build on a Ubuntu instance on the cloud, I would like to know what is the best to run it, for example, on the same instance I'm running a backend nodejs app with pm2, I know pm2 is mostly for backend services. when I go to…
1
vote
1 answer

Request path is wrong when deployed to github pages

I want to deploy https://github.com/S-N-O-R-L-A-X/Bridge-Tools to https://s-n-o-r-l-a-x.github.io/Bridge-Tools/. The deployment seems working well but the page is white. I have searched for some pages and tried as they said but I haven't used…
SNORLAX
  • 135
  • 8
1
vote
1 answer

Accessing ENV files in Vite Version 4

I am working on a web application built using HTML/CSS/JS + Vite.js. We were running on Vite v2.8.3 and wanted to upgrade to the latest v4.3.3. I was able to successfully complete the update and run the server, but then found that I was no longer…
Mickey Vershbow
  • 215
  • 3
  • 17
1
vote
0 answers

How to use CSS images with Vite?

Vite doesn't seem able to resolve paths for CSS url(). I have: .element { background-image: url("../assets/images/my-image.png"); } Instead of seeing the resolved path in Chrome, I just see the same unresolved path I specified in my CSS…
drake035
  • 3,955
  • 41
  • 119
  • 229
1
vote
0 answers

Using Vite for dynamic module federation with React Hooks

I have setup a test project with dynamic module federation using Vite. You can find the test repo here: https://github.com/iconag-bbasmer/vite-module-federation-test The issue I have though is that if I want to load multiple external modules into…
bbasmer
  • 127
  • 2
  • 11
1 2 3
99
100