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.
6,658
questions
9
votes
5
answers
13k
views
How to recognize env variables in typescript when using vite?
export const EnvironmentProvider: React.FC<EnvironmentProps> = ({ children }) => (
<EnvironmentContext.Provider value={{
APP_NAME: import.meta.env.VITE_APP_NAME,
GQL_URI: import....
3
votes
2
answers
5k
views
What does this vite error mean? SyntaxError: Unexpected token (6:180) at Object.pp$4.raise
I am upgrading my Sapper application to SvelteKit. I can run npm run dev fine and it starts my application on localhost:3000. When I browse to that URL, I get the following error:
SyntaxError: ...
14
votes
2
answers
13k
views
How to open a static website in localhost but generated with Vite and without running a server?
Note: the example I'm using is available on GitHub repository https://github.com/mary-perret-1986/primevue-poc
I created a simple project with Vue.js 3 + Vite + PrimeVue.
So far everything works like ...
7
votes
1
answer
4k
views
Node.js core module fallback in vite as webpack
In webpack when I get the error "Uncaught TypeError: path.join is not a function" I could add the configuration
resolve: {
fallback: { "path": require.resolve("path-...
2
votes
1
answer
4k
views
vite The requested module vue-router?
package.json:
{
"name": "blog",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"dev": "vite --...
1
vote
1
answer
510
views
Typescript error in vue 3 / vitejs / volar project on "required" html tag
don't know how to fix this error on the required tag:
(property) InputHTMLAttributes.required?: boolean | undefined Type
'string' is not assignable to type 'boolean | undefined'.ts(2322)
<input ...
6
votes
0
answers
7k
views
using environment variables with vitejs and vuejs
I'm trying to access environment variables at runtime in a Vue 3 application. I'm using vitejs for bundling.
the application is deployed on AKS, and values are stored as Kubernetes secrets.
I followed ...
7
votes
2
answers
4k
views
In vite + vue3 + TS project, AWS Amplify Failed to resolve components
I am having hard time to make AWS Amplify work with Vite.js
// First I was getting this error:
Uncaught ReferenceError: global is not defined
So, I added this script in index.html's head section
<...
2
votes
1
answer
3k
views
vite dev server execute middleware before all other middleware
With vue-cli it was possible to configure webpack devServer.before function like this:
devServer: {
before(app) {
app.get('/apiUrl', (req, res) => res.send(process.env.API_URL))
}
},...
19
votes
1
answer
9k
views
How to setup PhpStorm / WebStorm to work with Vite aliases?
Vite isn't supported by the PhpStorm / WebStorm yet, so given following Vite configuration:
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
'@': path.resolve(...
1
vote
0
answers
204
views
Prevent Vite from interpolating env-var-like strings
Hi guys I am working on a vite project where I need to use esbuild-wasm to build some user-provided code. I have some code like
import * as esbuild from "esbuild-wasm"
// some ...
9
votes
3
answers
36k
views
Vite library mode entry points
My vite config looks like this.
I want to have two entry points, as you can see in build.lib.entry I have the entry for my library, in this case src/main.js, but I would also like to have one entry ...
71
votes
8
answers
172k
views
Changing the input and output directory in Vite
I am using Vite (https://vitejs.dev/) for a static multipage site.
This is the default project folder structure after the build command.
my-app/
├─ node_modules/
├─ dist/
│ ├─ assets/
│ ├─ index....
7
votes
2
answers
7k
views
No such file or directory, when using Vite and Antd Pro Layout
No such file or directory, when using Vite and Antd Pro Layout
This is file vite.config.ts:
import { defineConfig } from 'vite';
import reactRefresh from '@vitejs/plugin-react-refresh';
import path ...
1
vote
1
answer
2k
views
Vite build and Global Vue 3 Components via Typescript
This question could be answered by fixing the typescript error or how best to handle global Vue 3 component registrations with Typescript. In a nutshell, if I run npm run dev (vite) the dev server ...