This template should help get you started developing with Vue 3 in Vite.
- node.js > 18
- pnpm
VSCode + Volar (and disable Vetur) + TypeScript Vue Plugin (Volar).
See Vite Configuration Reference.
nvm use 18
pnpm install
pnpm i18n:build # Generate i18n files. Run this script every time after you update i18n.json
pnpm dev
pnpm build
Lint with ESLint
pnpm lint
If you'd rather not manually use NVM, you can utilize .nvmrc for automatic switching.
Open your terminal and enter vi ~/.zshrc
(please note that everyone's path may be different). Then, paste the following script on the last line:
# place this after nvm initialization!
autoload -U add-zsh-hook
load-nvmrc() {
local node_version="$(nvm version)"
local nvmrc_path="$(nvm_find_nvmrc)"
if [ -n "$nvmrc_path" ]; then
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
if [ "$nvmrc_node_version" = "N/A" ]; then
nvm install
elif [ "$nvmrc_node_version" != "$node_version" ]; then
nvm use
fi
elif [ "$node_version" != "$(nvm version default)" ]; then
echo "Reverting to nvm default version"
nvm use default
fi
}
add-zsh-hook chpwd load-nvmrc
load-nvmrc
Once saved, enter source ~/.zshrc
to apply the changes.