@flywen/tsconfig
v1.0.0
Published
Shared TypeScript configurations for multiple environments (Node.js, React, Vue, Web Library)
Maintainers
Readme
@flywen/ts-config
Shared TypeScript configurations for multiple environments.
Installation
npm install -D @flywen/ts-config
# or
yarn add -D @flywen/ts-config
# or
pnpm add -D @flywen/ts-configUsage
Extend the configuration in your tsconfig.json:
Base Configuration (tsconfig.base.json)
{
"extends": "@flywen/ts-config/tsconfig.base.json"
}Node.js Application (tsconfig.node.json)
For Node.js applications (not libraries):
{
"extends": "@flywen/ts-config/tsconfig.node.json"
}Node.js Library (tsconfig.node-lib.json)
For Node.js libraries that need declaration files:
{
"extends": "@flywen/ts-config/tsconfig.node-lib.json"
}React (tsconfig.react.json)
For React applications with Vite/modern bundlers:
{
"extends": "@flywen/ts-config/tsconfig.react.json"
}Vue (tsconfig.vue.json)
For Vue 3 applications with Vite:
{
"extends": "@flywen/ts-config/tsconfig.vue.json"
}Web Library (tsconfig.web-lib.json)
For web libraries that need declaration files:
{
"extends": "@flywen/ts-config/tsconfig.web-lib.json"
}Configurations
tsconfig.base.json
Base configuration with shared settings:
- All strict mode options enabled
esModuleInterop: trueskipLibCheck: trueforceConsistentCasingInFileNames: trueresolveJsonModule: truedeclaration: truedeclarationMap: truesourceMap: true
tsconfig.node.json
Node.js 18+ application configuration:
target: "ES2022"module: "NodeNext"moduleResolution: "NodeNext"lib: ["ES2022"]outDir: "./dist"rootDir: "./src"types: ["node"]
tsconfig.node-lib.json
Node.js library configuration:
- Inherits from base
target: "ES2022"module: "NodeNext"moduleResolution: "NodeNext"declaration: truedeclarationMap: truetypes: ["node"]
tsconfig.react.json
React (Vite/modern bundler) configuration:
target: "ESNext"module: "ESNext"moduleResolution: "bundler"jsx: "react-jsx"jsxImportSource: "react"lib: ["DOM", "DOM.Iterable", "ESNext"]noEmit: true(Vite handles compilation)- Path aliases configured (
@/*)
tsconfig.vue.json
Vue 3 (Vite) configuration:
target: "ESNext"module: "ESNext"moduleResolution: "bundler"jsx: "preserve"jsxImportSource: "vue"lib: ["ESNext", "DOM", "DOM.Iterable"]types: ["vite/client"]noEmit: true(Vite handles compilation)- Path aliases configured (
@/*) - Includes
.vuefiles
tsconfig.web-lib.json
Web library configuration:
target: "ES2020"module: "ESNext"moduleResolution: "bundler"lib: ["ESNext", "DOM", "DOM.Iterable"]declaration: truedeclarationMap: trueoutDir: "./dist"rootDir: "./src"
Notes
- All configurations extend from
tsconfig.base.json - React and Vue configs assume usage with Vite or similar modern bundlers
- Node.js configs support both ESM (
NodeNext) and CJS - Path aliases (
@/*) are pre-configured for React, Vue, and web-lib configs
License
MIT
