tsconfig.json
You can enhance your developer experience in vscode and other editors by creating a tsconfig.json file.
There are base configs provided by @roots/bud for you to extend:
Example tsconfig.json
{
"extends": "@roots/bud/config/tsconfig.json",
"compilerOptions": {
"baseUrl": "./src",
"outDir": "./dist",
"paths": {
"@src/*": ["./src/*"]
},
"types": [
"node",
"webpack/module",
"@roots/bud",
"@roots/bud-postcss",
"@roots/bud-react",
"@roots/bud-swc",
"@roots/bud-tailwindcss"
]
},
"files": ["bud.config.ts"],
"include": ["src"],
"exclude": ["node_modules", "dist"],
"bud": {
"useCompilerOptions": false
}
}
Tips
- Add any bud extensions you are using to
compilerOptions.typesso that you're IDE can will pick up on the types. We also recommend addingnodeandwebpack/moduleto this array. - Add any aliases you are using to
compilerOptions.pathsso that your IDE can resolve them. - Make sure
bud.config.jsis included in theincludearray so that your IDE will apply discovered types to the config file.
bud.useCompilerOptions
If you enable bud.useCompilerOptions in your tsconfig.json file then @roots/bud will apply certain options from compilerOptions to the bud.js config.
compilerOptions.baseUrlwill set the@srcpath.compilerOptions.outDirwill set the@distpath.compilerOptions.pathswill create bud paths and aliases.includewill callbud.compilePathson the supplied values.