Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions tsconfig-build.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
{
"extends": "./tsconfig.json",
"include": [
"lib"
]
"compilerOptions": {
"outDir": "dist",
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"inlineSources": true,
"module": "ESNext",
"target": "ES2019",
"moduleResolution": "Node",
"strict": true,
"esModuleInterop": true
},
"include": ["lib"]
}
22 changes: 12 additions & 10 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,36 @@ import { extname, relative, resolve } from 'path'
import { fileURLToPath } from 'node:url'
import { glob } from 'glob'


export default defineConfig({
plugins: [react(), dts({ include: ['lib'], insertTypesEntry: true }), libInjectCss()],
plugins: [
react(),
dts({ include: ['lib'], insertTypesEntry: true }),
libInjectCss(),
],
build: {
copyPublicDir: false,
lib: {
entry: resolve(__dirname, 'lib/main.ts'),
formats: ['es']
formats: ['es'],
},
sourcemap: true,
minify: false,
rollupOptions: {
external: ['react', 'react/jsx-runtime', 'tailwindcss'],
input: Object.fromEntries(
glob.sync('lib/**/*.{ts,tsx}').map(file => [
glob.sync('lib/**/*.{ts,tsx}').map((file) => [
// The name of the entry point
// lib/nested/foo.ts becomes nested/foo
relative(
'lib',
file.slice(0, file.length - extname(file).length)
),
relative('lib', file.slice(0, file.length - extname(file).length)),
// The absolute path to the entry file
// lib/nested/foo.ts becomes /project/lib/nested/foo.ts
fileURLToPath(new URL(file, import.meta.url))
fileURLToPath(new URL(file, import.meta.url)),
])
),
output: {
assetFileNames: 'assets/[name][extname]',
entryFileNames: '[name].js',
}
},
},
},
})