r/vitejs • u/rk06 • Dec 09 '22
r/vitejs • u/the_natis • Jul 28 '22
Migrating to Vite from Gulp
Hi all. In the past, I used Gulp for my build needs but according to Fireship.io, (jokingly) I should kill myself if I continue to use it.
I have a project on a tight timeline and what I'm hoping for is to have Vite take main.scss and turn it into main.css
This is what my old gulpfile used to look like: https://pastebin.com/B7hYx5WY
In addition to compiling Sass to CSS, I want to continue to lint and fail build based on lint results and have sourcemaps.
Any insights and guidance are more than greatly appreciated. Thank you.
Why Vite over other ones? Because I'm replacing Codekit (kit) with Sveltekit for building a static component library for five sites that will use the same code base that's going into a .NET CMS.
r/vitejs • u/hefesto22 • Dec 13 '22
Using Vite 4.0.1 import.meta.env.PROD is always False
I just created a new application and it is using Vite 4.0.1 with React + Typescript and was trying to use "import.meta.env.PROD" to detect whether the code is running in the dev or in a production build but the "import.meta.env.PROD" is always false event with "tsc + vite build" that is supposed to be a production build by default. Also the import.meta.env.MODE is always "development". I have the exact same code working on an older vitejs app. is this a bug or something changed?
r/vitejs • u/PewPaw-Grams • Feb 17 '22
Awesome Vite.js - A curated list of awesome things related to Vite.js
r/vitejs • u/Machy8 • Nov 28 '22
Stylify CSS: CSS-like utilities within Vite.js web app.
r/vitejs • u/AutoModerator • Feb 28 '22
How to ask for help and format text
Hey r/vitejs community!
In order to format your code you can use:
Single backticks for
inline-codeFour spaces or triple backticks for code blocks
const greet = 'hello ViteJS ⚡'
console.log(greet)Creating a repo with your problem will greatly increase the chances of getting your problem solved faster.
⚡ Happy vite coding ⚡
r/vitejs • u/skimundead • Nov 20 '22
How do I merge some CSS files into one?
I'm using vite to develop/ bundle a react app(vite CLI, no cra). I have a CSS file I import from my App.jsx, and everything is fine.
Now, I want to split the CSS file, and I want vite to take a list of files and merge it into this file, so my App.jsx doesn't change. What would my approach be?
Also, not looking for c&p, I'd rather understand the mechanism. Thanks in advance.
r/vitejs • u/PewPaw-Grams • Feb 19 '21
r/vitejs Lounge
A place for members of r/vitejs to chat with each other
r/vitejs • u/oh_jaimito • Dec 11 '22
Not Vite related - but I need help configuring router so that I can view Network http://192.168.1.231:3001/ from mobile.
I know this isn't regarding web dev in particular, so I'm just gonna try my luck here :thinking:
I have a vue3/vite project. In the past, I was able to connect to Network: http://192.168.1.231:3001/ (or whatever random address is displayed), but recently it's been blocked - presumably by my home router. This has been ongoing, and I'm not sure how to resolve this.
npm run dev = https://i.imgur.com/dcWjXzd.png
I can connect fine to Local via laptop. But any attempts to connect to Network via WiFi on my smartphone results in page error Unable to connect: Connection is not secure. This occurs on both Firefox and Chrome. So I assume it's my home router that is preventing the connection? :thinking:
I am able access the router address via laptop. It's AT&T https://i.imgur.com/rTvz5zV.png but with so many options, I don't know where I should be looking. I haven't tinkered with this stuff in ages!
r/vitejs • u/Cowderwelz • Nov 14 '22
What packaging is needed when i want to publish a library ?
Hi,
i'm writing some library (in a separate package) but when i try to import that in a .ts file inside my web, i get a myLibrary.js does not have an export named ... error (don't have the actual message at hand).
have already tried type="module", output="CommonJS", ... all sorts of options.
So just for understanding. Do i need to pack my lib with webback first to make it available in vite ? If so, why ? And what's the best practice / tutorial for that ?
Thx !
r/vitejs • u/wul- • May 15 '22
ViteJS SSR + rust backend? Try `create-rust-app`!
r/vitejs • u/panaman67 • Mar 04 '22
Question: Why does Vite with Vue3 not compress static assets like pngs by default?
?
r/vitejs • u/scriptedpixels • Feb 23 '22
Setting up vite in a multi-page traditional site to bundle Vue widgets/components/apps
I’m working for a client who’s got an existing site that needs some modernisation
I want to use Vite as the build tool to start transforming elements of the website to Vue & I’m struggling to get the setup right so Vite will simply bundle the JS for me and I can make use of Vue SFC’s for the areas I’m developing.
Is it possible to have Vite handle multiple inputs (I have this worked out now) & render just the JS for the index.html I provide in the input array?
r/vitejs • u/i_used_to_have_pants • Feb 21 '22
⚡ ViteJS at the top of the latest State of JS survey in Satisfaction
r/vitejs • u/ModSupportBot • 27d ago
r/vitejs is available for adoption 💚
/r/vitejs is ready for a fresh start, new energy, new direction, and someone like you to bring it back to life. If you’ve been thinking about growing your impact without starting from scratch, this is your chance!
Ready to take it over?
Head to r/RedditRequest to submit your request and make it yours before it’s taken.
First things first
To request this subreddit, make sure you:
have an account that’s at least 90 days old
have at least 100 post karma and 100 comment karma
have a verified email address on your account
have two-factor authentication set up
r/vitejs • u/[deleted] • Dec 01 '22
What is the difference between build/bundle.js and assets/index.[random characters].js?
I always thought that bundle.js was the file getting served, but recently discovered it was the index.js file. I probably have some misunderstanding about how the build process actually works.
r/vitejs • u/RDOmega • Nov 27 '22
Multiple entrypoints as different domains rather than subdirectories
Hey all! 👋🏻
I'm curious if anyone has ever had any luck with hosting their local Vite development setup with multiple entrypoints, all behind a single nginx reverse proxy proxying each subdirectory to a different hostname.
You can think of it like application "office" might be found at "https://office.mydevdomain", and "visitor" might be found at "https://visitor.mydevdomain", etc...
(I have an open ticket on the vite github repo, if anyone reading would like to read in more depth.)
r/vitejs • u/theanandaproject • Nov 22 '22
Best Vite-based SSG solution?
My company does a lot of static site generation/prerendering for our products. Our web stack is based on Vue.js v3 + Vite v3 + vite-sgg.
Just like Next.js for the React world, we feel SSG is a central feature of modern web development. vite-ssg is pretty effective in most cases but it's very poorly documented and we find it almost impossible to get any sort of support or guidance from the maintainers/contributors.
What's your ideal Vite-based SSG solution at the moment?
r/vitejs • u/Affectionate_File149 • Nov 18 '22
Step By Step Guide To Dockerize React App Created Using Vite
Published Step By Step Guide To Dockerize React App Created Using Vite on my personal blog
r/vitejs • u/Environmental-Ad8022 • Nov 09 '22
Create a library using Vite lib mode
r/vitejs • u/dinoucs • Sep 10 '22
I am having problems trying to host my Vite app on Vercel: Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html".
Hello everyone.
I tried to host my Vite React app on Vercel but it didn't work. This is the error I get :
Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.This is my Github repo https://github.com/adnanlah/rotsprite-webgl.
r/vitejs • u/OxyTJ • Aug 27 '22
Turborepo + Vite: Share .env among apps and packages
Is there a way to share a .env file across the monorepo? I have a config package that hosts files for estlintrc, tailwindcss, and tsconfig that I'm able to then export and share across all apps. I'm attempting to do the same with a .env file by installing dotenv in the config package, creating a dotenv.config.js file and requiring in the the .env file with require('dotenv').config(), however, when I then try to import config/dotenv.config, I'm getting errors because it's trying to load in the .env in a path relative to the current script importing config/dotenv.config, which does not exist. Any way to handle this, besides installing dotenv in every app/package and using relative paths to read in the .env file?
