Template for Vue component library
Featuring Vite, Vue, Jest, TypeScript.
Follow the _Dummy
example to create your component library.
Add import and export in index.ts
Replace dummy-component
with your component names in these locations:
- package.json
- vite.config.ts
pnpm install
npm run build
-
Create or Edit
~/.npmrc
(Attention: Not the one in this repository!)//npm.pkg.github.com/:_authToken={YOUR_GIT_REPO_AUTH_TOKEN}
-
Edit
.npmrc
in this repository if you are publishing to somewhere else@xmj-alliance:registry=https://npm.pkg.github.com
Create the .npmrc
file in the target repository. Change the registry URL if necessary.
@xmj-alliance:registry=https://npm.pkg.github.com
Import the esm (by referencing this module should be enough),
- and the
style.css
import { Dummy } from "@xmj-alliance/pit-template-vue-component";
// usually the global style.scss
@import "~@xmj-alliance/pit-template-vue-component/style.css";
// => or alternatively import in the JS way in main.ts
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 <script setup>
SFCs, check out the script setup docs to learn more.
- VS Code + Volar (and disable Vetur) + TypeScript Vue Plugin (Volar).
TypeScript cannot handle type information for .vue
imports by default, so we replace the tsc
CLI with vue-tsc
for type checking. In editors, we need TypeScript Vue Plugin (Volar) to make the TypeScript language service aware of .vue
types.
If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a Take Over Mode that is more performant. You can enable it by the following steps:
- Disable the built-in TypeScript Extension
- Run
Extensions: Show Built-in Extensions
from VSCode's command palette - Find
TypeScript and JavaScript Language Features
, right click and selectDisable (Workspace)
- Run
- Reload the VSCode window by running
Developer: Reload Window
from the command palette.