wip: adding build step

This commit is contained in:
Juan Di Toro 2023-10-07 18:29:36 +02:00
parent 4e4ced81ba
commit c043c5b6a1
2 changed files with 36 additions and 10 deletions

18
tsconfig.build.json Normal file
View File

@ -0,0 +1,18 @@
{
"compilerOptions": {
"composite": true,
"typeRoots": ["src/vite-env.d.ts"]
},
"include": [
"src"
],
"exclude": [
"**/*.stories.tsx"
],
"references": [
{
"path": "./tsconfig.json"
}
]
}

View File

@ -1,20 +1,28 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import scopeTailwind from "vite-plugin-scope-tailwind";
import { resolve } from 'path'
// import reactTailwindClassnamePrefixer from "./lib/vite-plugin-react-classname-prefixer";
// import { resolve } from 'path'
import svgr from "vite-plugin-svgr";
import dts from 'vite-plugin-dts'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [svgr(), react(), scopeTailwind({react: true})],
plugins: [svgr(), react(), scopeTailwind({react: true}), dts({
tsconfigPath: "tsconfig.build.json"
})],
resolve: {
// I have no clue why aliases are not working at all...
alias: {
'@styles/': resolve(__dirname, './styles'),
'@components/': resolve(__dirname, './src/components'),
'@assets/': resolve(__dirname, './src/assets'),
'@': resolve(__dirname, './src'),
// TODO: For some reason aliases are not working....
// alias: {
// '@styles/': resolve(__dirname, './styles'),
// '@components/': resolve(__dirname, './src/components'),
// '@assets/': resolve(__dirname, './src/assets'),
// '@': resolve(__dirname, './src'),
// },
},
build: {
manifest: true,
outDir: 'dist',
emptyOutDir: true,
sourcemap: true,
},
})