mm
This commit is contained in:
@@ -13,22 +13,13 @@
|
||||
"docs/[^.]*",
|
||||
"doc/[^.]*"
|
||||
],
|
||||
"module": "index.js",
|
||||
"typings": "index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.cjs.js"
|
||||
}
|
||||
},
|
||||
"./index.css": "./dist/index.css"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc --project tsconfig.build.json"
|
||||
"build": "vite build && tsc --project tsconfig.build.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@floating-ui/react": "^0.27.20",
|
||||
@@ -37,7 +28,22 @@
|
||||
"devDependencies": {
|
||||
"@types/node": "^26.6.6",
|
||||
"@types/react": "^19.3.0",
|
||||
"@types/react-dom": "^19.3.0"
|
||||
"@types/react-dom": "^19.3.0",
|
||||
"@babel/core": "^7.29.13",
|
||||
"@eslint/js": "^10.0.1",
|
||||
"@rolldown/plugin-babel": "^0.3.1",
|
||||
"@types/babel__core": "^7.20.5",
|
||||
"@vitejs/devtools": "^0.8.3",
|
||||
"@vitejs/devtools-rolldown": "^0.8.3",
|
||||
"@vitejs/devtools-vite": "^0.8.3",
|
||||
"@vitejs/plugin-react": "^6.3.0",
|
||||
"babel-plugin-react-compiler": "^1.0.0",
|
||||
"eslint": "^10.15.0",
|
||||
"eslint-plugin-react-hooks": "^7.1.1",
|
||||
"eslint-plugin-react-refresh": "^0.5.8",
|
||||
"globals": "^17.14.0",
|
||||
"typescript": "~6.0.3",
|
||||
"typescript-eslint": "^8.73.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^19.3.1",
|
||||
|
||||
@@ -9,10 +9,12 @@
|
||||
"module": "esnext",
|
||||
// 所有项目必须开,兼容 es 和 cjs 导入,允许 import React from 'react' ,而非 import * as React 。
|
||||
"esModuleInterop": true,
|
||||
// 允许导入 ts,tsx 扩展名,include 里可以省略后缀。
|
||||
// 允许导入 ts,tsx 扩展名。
|
||||
"allowImportingTsExtensions": true,
|
||||
// 允许 js,jsx 扩展名,include 里可以省略后缀。
|
||||
// 允许导入 js,jsx 扩展名。
|
||||
"allowJs": true,
|
||||
// 允许导入 json 模块,而不只是 ts,js,css 。
|
||||
"resolveJsonModule": true,
|
||||
// 启用装饰器,也就是 @XXX 注解。
|
||||
"experimentalDecorators": true,
|
||||
// 发射装饰器元数据。
|
||||
@@ -37,7 +39,7 @@
|
||||
"incremental": true
|
||||
},
|
||||
// 本配置文件的作用范围,包含根目录下的一切文件,包括 vite.config.ts 等配置文件
|
||||
"include": ["**/*.ts",],
|
||||
"include": ["**/*.ts", "*/*.tsx"],
|
||||
// 本配置文件排除的范围。
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
import react, { reactCompilerPreset } from "@vitejs/plugin-react";
|
||||
import babel from "@rolldown/plugin-babel";
|
||||
import { defineConfig } from "vite";
|
||||
import { resolve } from "path";
|
||||
import pkg from "./package.json" with { type: "json" };
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
devtools: {
|
||||
// Remove this `apply` property to enable devtools for build as well
|
||||
// apply: 'serve',
|
||||
},
|
||||
plugins: [react(), babel({ presets: [reactCompilerPreset()] })],
|
||||
|
||||
build: {
|
||||
// Must write, vite/css-minify cannot recognize some ruler
|
||||
cssMinify: false,
|
||||
lib: {
|
||||
entry: resolve(import.meta.dirname, "src/index.ts"),
|
||||
name: "ui-react",
|
||||
formats: ["es"],
|
||||
fileName: (format) => {
|
||||
return `index.${format}.js`;
|
||||
},
|
||||
cssFileName: "index",
|
||||
},
|
||||
rolldownOptions: {
|
||||
external: ["react/jsx-runtime", ...Object.keys(pkg.peerDependencies)],
|
||||
output: {
|
||||
// 为 UMD 构建提供 global 变量
|
||||
globals: {
|
||||
react: "React",
|
||||
"react-dom": "ReactDOM",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user