create-vite是一个 NPM 包,它的作用是创建一个新的 Vite 项目。在 Vite 官方的 GitHub 仓库中,你可以看到create-vite工具包的实现。它的主要功能包括: 引导用户输入:通过命令行提示,帮助用户选择项目模板(例如 Vue、React 等)。 下载模板:根据用户选择的模板,自动下载相应的项目结构。 初始化项目:生成 Vite 项目...
react-swc-ts preact preact-ts lit lit-ts svelte svelte-ts solid solid-ts qwik qwik-ts You can use.for the project name to scaffold in the current directory. Community Templates create-vite is a tool to quickly start a project from a basic template for popular frameworks. Check out Aweso...
除了create-vite之外,我们经常使用的 Taro CLI、Leo 脚手架等也都是基于它实现的终端问卷功能。 一个单选题可以这样定义: {type:'select',name:'framework',message:'请选择一个框架',choices: [ {title:'React',description:'The library for web and native user interfaces',value:'react'}, {title:'Vue'...
最终在依赖加载和查找到之后,会通过runScript找到这个包的package.json中指定的bash脚本(bin命令配置),并执行其create-*命令,与vite相关的即是create-vite。 create-vite 经过上面的分析,可以确认最终与vite相关的命令的起始位置就是vitejs/create-vite/package.json中的create-vite脚本。 那么就让我正式进入create-vite...
npm create vite@latest my-vite-project 其中my-vite-project是你的项目名称,你可以根据需要替换为任意名称。 执行后,它会提示你选择项目模板。你可以选择以下模板之一: vanilla:普通的 JavaScript 项目 vue:Vue 3 项目 react:React 项目 react-ts:React + TypeScript 项目 ...
Create Vite React App provides templates similar to classic CRA, or Create React Application template, but using modern Vite based templates. Also it comes options with pre configured Jest and RTL testing. How to use Install the package
1.npm create vite@latest: 使用Vite 构建工具创建项目模板。 Vite 是一个现代化的前端构建工具,用于快速搭建现代化的 Vue、React 或者原生 JavaScript 项目。 通过该命令创建的项目模板具有现代化的构建特性,如快速的热模块替换、即时的开发服务器、基于 ES 模块的构建等,能够提供更快的开发和构建速度。
需要发布的 npm 包,默认是 vite 版本号生成方式 name: Releaseon:workflow_dispatch:inputs:branch:description: "branch"required: truetype: stringdefault: "main"package:description: "package"required: truetype: choiceoptions:- vite- plugin-legacy- plugin-vue- plugin-vue-jsx- plugin-react- create-vite...
发现create-vite-app和create-react-app前面都有create,于是去npm包官网查看了npm init的说明: * npm init foo -> npx create-foo * npm init @usr/foo -> npx @usr/create-foo * npm init @usr -> npx @usr/create 1. 2. 3. 所以:npm init vite-app 和npx create-vite-app 是一样的,npm ini...
虽然之前在创建vue或者react应用时,我都用到了npm init xxx,但我都没怎么关注npm init xxx背后发生了什么。 比如npm init @vitejs/app,只知道官网说它是用来创建应用的,但很少会去想到其背后是调用了npx @vitejs/create-app,其实就是在执行一个create-app脚本。