- Forums
- react
- Vite Start New Project Command For React App, Typescript Or Vanilla Javascript
This Page Contains information about Vite Start New Project Command For React App, Typescript Or Vanilla Javascript By dd in category react with 0 Replies. [5075], Last Updated: Mon Jun 24, 2024
dd
Fri Feb 24, 2023
0 Comments
367 Visits
Just found out about Vite. Better than using create-react-app, it was good while it lasted, now I am making my move to Vite!
Resource: https://vitejs.dev/guide/
This is how you would create a new project with Vite, fast !
$ npm create vite@latest
- Give it a project Name
- Select the platform
$ cd project name
$ npm install
- localhost:3000
- done
Notes to run on SSL and publish to CloudFlare:
IN ORDER TO WORK WITH SSL, YOU WILL NEED TO RUN VITE ON SSL WITH PORT 5173 FOR CORS TO WORK
$ npm run dev -- --port 5173
$ npm run preview -- --port 5173
PUSH NEW VERSION TO CLOUDFLARE:
git add .
git commit -m "Wad on Detached HEADin GIT now in main"
npm run build:prod
npx wrangler pages publish dist
Add Login authentication via Laravel API
https://www.webune.com/forums/add-authentication-to-react-vite-using-laravel-backend.html
Here is another way of doing it - create a react app
- Command to create a new app:
# npm 6.x
$ npm create vite@latest
[app-name]
--template vue
# npm 7+, extra double-dash is needed:
$ npm create vite@latest
[app-name]
-- --template vue
# yarn
$ yarn create vite
[app-name]
--template vue
$ cd [app-name]
$ npm install
$ npm run dev
Local: http://127.0.0.1:5173/
And yet another way:
$ npm init @vitejs/app
- Give it a project Name
- Select the platform
$ cd project name
$ npm i
- Run Dev Server:
$ npm run dev
- Run Build:
$ npm run build
- Preview Build:
$ npm run serve
Hope that helps.
l