TypeScript configuration presets specifically designed for Vue.js projects
npx @tessl/cli install tessl/npm-vue--tsconfig@0.8.0Vue TSConfig provides TypeScript configuration presets specifically designed for Vue.js projects. It offers three main configurations: a base runtime-agnostic configuration for general Vue development, a DOM-focused configuration for browser environments, and a library configuration for projects that need to emit declaration files.
npm add -D @vue/tsconfigVue TSConfig configurations are imported by extending them in your tsconfig.json:
{
"extends": "@vue/tsconfig/tsconfig.json"
}Multiple configurations can be extended together:
{
"extends": [
"@vue/tsconfig/tsconfig.dom.json",
"@vue/tsconfig/tsconfig.lib.json"
]
}{
"extends": "@vue/tsconfig/tsconfig.dom.json",
"compilerOptions": {
"outDir": "./dist"
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
}For Node.js environments with Vue:
{
"extends": [
"@tsconfig/node22/tsconfig.json",
"@vue/tsconfig/tsconfig.json"
],
"compilerOptions": {
"types": ["node"]
}
}Runtime-agnostic TypeScript configuration providing core Vue.js settings.
{
"extends": "@vue/tsconfig/tsconfig.json"
}Configuration Details:
"jsx": "preserve", "jsxImportSource": "vue""noEmit": true (no file output by default)"noUncheckedIndexedAccess": true for safer array/object accessCompiler Options:
{
"compilerOptions": {
"noEmit": true,
"module": "ESNext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"allowImportingTsExtensions": true,
"moduleDetection": "force",
"jsx": "preserve",
"jsxImportSource": "vue",
"noImplicitThis": true,
"strict": true,
"noUncheckedIndexedAccess": true,
"verbatimModuleSyntax": true,
"target": "ESNext",
"useDefineForClassFields": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"libReplacement": false,
"skipLibCheck": true
}
}Configuration optimized for browser/DOM environments, extending the base configuration.
{
"extends": "@vue/tsconfig/tsconfig.dom.json"
}Configuration Details:
./tsconfig.json)Compiler Options:
{
"extends": "./tsconfig.json",
"compilerOptions": {
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"types": []
}
}Configuration for library development, enabling declaration file emission.
{
"extends": [
"@vue/tsconfig/tsconfig.dom.json",
"@vue/tsconfig/tsconfig.lib.json"
]
}Configuration Details:
Compiler Options:
{
"compilerOptions": {
"noEmit": false,
"declaration": true,
"emitDeclarationOnly": true,
"skipLibCheck": false
}
}For standard Vue web applications:
{
"extends": "@vue/tsconfig/tsconfig.dom.json"
}For building Vue component libraries with type declarations:
{
"extends": [
"@vue/tsconfig/tsconfig.dom.json",
"@vue/tsconfig/tsconfig.lib.json"
]
}For Vue applications with SSR or Node.js integration:
{
"extends": [
"@tsconfig/node22/tsconfig.json",
"@vue/tsconfig/tsconfig.json"
],
"compilerOptions": {
"types": ["node"]
}
}For testing with tools like Vitest:
{
"extends": [
"@vue/tsconfig/tsconfig.dom.json"
],
"compilerOptions": {
"types": ["vitest/globals"]
}
}Key breaking changes in v0.3.x and later:
tsconfig.web.json → tsconfig.dom.jsontsconfig.node.json removed (use @tsconfig/nodeX instead)"node" to "bundler"Some packages may have issues with the new "bundler" resolution mode:
exports field in package.json"resolvePackageJsonExports": false if needed{
"extends": "@vue/tsconfig/tsconfig.dom.json",
"compilerOptions": {
"resolvePackageJsonExports": false
}
}Common issues and solutions:
exports field or disable resolvePackageJsonExportsjsx: "preserve" and jsxImportSource: "vue" are not overriddenstrict: true requirements are met.vue extensions with allowImportingTsExtensions: trueThe configurations follow the standard TypeScript configuration schema:
interface TSConfig {
extends?: string | string[];
compilerOptions?: {
// Core options
target?: string;
module?: string;
moduleResolution?: "node" | "bundler";
// Vue-specific
jsx?: "preserve" | "react" | "react-jsx";
jsxImportSource?: string;
// Output
noEmit?: boolean;
declaration?: boolean;
emitDeclarationOnly?: boolean;
// Type checking
strict?: boolean;
noImplicitThis?: boolean;
noUncheckedIndexedAccess?: boolean;
// Libraries and types
lib?: string[];
types?: string[];
// Module resolution
resolveJsonModule?: boolean;
allowImportingTsExtensions?: boolean;
resolvePackageJsonExports?: boolean;
// Other
skipLibCheck?: boolean;
esModuleInterop?: boolean;
forceConsistentCasingInFileNames?: boolean;
libReplacement?: boolean;
verbatimModuleSyntax?: boolean;
useDefineForClassFields?: boolean;
moduleDetection?: "auto" | "legacy" | "force";
};
include?: string[];
exclude?: string[];
}