Capítulo 14 de 108
Gatsby setup is Tailwind CSS v3 only (docs explicitly recommend other frameworks for v4 on new projects). Requires manual webpack alias resolution via gatsby-node.ts, not just tsconfig.
npm init gatsby: scaffolds project; prompts for TypeScript and Tailwind CSS during setup.gatsby-node.ts webpack alias: Gatsby needs onCreateWebpackConfig to register the @/* alias at the bundler level, since tsconfig paths alone don't affect Gatsby's webpack resolution.npm init gatsby
npx shadcn@latest init
npx shadcn@latest add button
import * as path from "path"
export const onCreateWebpackConfig = ({ actions }) => {
actions.setWebpackConfig({
resolve: {
alias: {
"@/components": path.resolve(__dirname, "src/components"),
"@/lib/utils": path.resolve(__dirname, "src/lib/utils"),
},
},
})
}
vite.config.ts alias do Vite.gatsby-node.ts: tsconfig.json paths alone won't make Gatsby's build resolve @/components/ui/* imports.gatsby-node.ts).