mirror of
https://github.com/tuono-labs/tuono
synced 2026-07-25 12:52:47 -07:00
chore: add internal vite config (#568)
This commit is contained in:
committed by
GitHub
parent
d37b655add
commit
12e0937174
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "vite-config",
|
||||
"version": "1.0.0",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"exports": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"lint": "eslint .",
|
||||
"format": "prettier --check --ignore-unknown --ignore-path ../../.prettierignore .",
|
||||
"format:fix": "prettier --write --ignore-unknown --ignore-path ../../.prettierignore .",
|
||||
"types": "tsc --noEmit"
|
||||
},
|
||||
"devDependencies": {
|
||||
"oxc-transform": "0.50.0",
|
||||
"rollup-plugin-preserve-directives": "0.4.0",
|
||||
"unplugin-isolated-decl": "0.11.0",
|
||||
"vite": "5.4.14",
|
||||
"vite-plugin-externalize-deps": "0.9.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import type { UserConfig } from 'vite'
|
||||
import { preserveDirectives } from 'rollup-plugin-preserve-directives'
|
||||
import { externalizeDeps } from 'vite-plugin-externalize-deps'
|
||||
import UnpluginIsolatedDecl from 'unplugin-isolated-decl/vite'
|
||||
|
||||
interface Options {
|
||||
/** Entry file, e.g. `./src/index.ts` */
|
||||
entry: string | Array<string>
|
||||
}
|
||||
|
||||
export function defineViteConfig({ entry }: Options): UserConfig {
|
||||
const outDir = 'dist'
|
||||
|
||||
return {
|
||||
build: {
|
||||
outDir,
|
||||
minify: false,
|
||||
sourcemap: true,
|
||||
lib: {
|
||||
entry,
|
||||
formats: ['es'],
|
||||
fileName: 'esm/[name]',
|
||||
},
|
||||
rollupOptions: {
|
||||
output: {
|
||||
preserveModules: true,
|
||||
entryFileNames: 'esm/[name].js',
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
externalizeDeps(),
|
||||
preserveDirectives(),
|
||||
UnpluginIsolatedDecl({ transformer: 'oxc' }),
|
||||
],
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": ["src"],
|
||||
"compilerOptions": {
|
||||
// Modules
|
||||
"moduleResolution": "node16",
|
||||
"module": "Node16",
|
||||
|
||||
// Emit
|
||||
"noEmit": false,
|
||||
"declaration": true,
|
||||
"outDir": "dist"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user