From e825175615e80788ca9bbde1b24722ea9325b17d Mon Sep 17 00:00:00 2001 From: neverland Date: Sun, 8 Dec 2024 16:34:17 +0800 Subject: [PATCH] chore(area-data): use Rslib to build (#13251) --- packages/vant-area-data/build.js | 1 - packages/vant-area-data/package.json | 19 ++++++++----------- packages/vant-area-data/rslib.config.ts | 11 +++++++++++ pnpm-lock.yaml | 9 +++------ 4 files changed, 22 insertions(+), 18 deletions(-) delete mode 100644 packages/vant-area-data/build.js create mode 100644 packages/vant-area-data/rslib.config.ts diff --git a/packages/vant-area-data/build.js b/packages/vant-area-data/build.js deleted file mode 100644 index b045310bc..000000000 --- a/packages/vant-area-data/build.js +++ /dev/null @@ -1 +0,0 @@ -require('../vant-use/build.cjs'); diff --git a/packages/vant-area-data/package.json b/packages/vant-area-data/package.json index 0bbe3c5f4..c549885c7 100644 --- a/packages/vant-area-data/package.json +++ b/packages/vant-area-data/package.json @@ -2,14 +2,15 @@ "name": "@vant/area-data", "version": "2.0.0", "description": "Vant 省市区数据", - "main": "dist/index.cjs.js", - "module": "dist/index.esm.mjs", + "type": "module", + "main": "dist/index.cjs", + "module": "dist/index.js", "types": "dist/index.d.ts", "exports": { ".": { "types": "./dist/index.d.ts", - "import": "./dist/index.esm.mjs", - "require": "./dist/index.cjs.js" + "import": "./dist/index.js", + "require": "./dist/index.cjs" }, "./package.json": "./package.json" }, @@ -18,11 +19,8 @@ "dist" ], "scripts": { - "clean": "rimraf ./dist", - "dev": "node ./build.js -w", - "build:types": "tsc -p ./tsconfig.json --emitDeclarationOnly", - "build:bundle": "node ./build.js", - "build": "pnpm clean && pnpm build:bundle && pnpm build:types", + "dev": "rslib build -w", + "build": "rslib build", "release": "vant-cli release", "prepare": "pnpm build" }, @@ -39,8 +37,7 @@ "author": "chenjiahan", "license": "MIT", "devDependencies": { - "esbuild": "^0.24.0", - "rimraf": "^6.0.1", + "@rslib/core": "^0.1.3", "typescript": "^5.7.2" } } diff --git a/packages/vant-area-data/rslib.config.ts b/packages/vant-area-data/rslib.config.ts new file mode 100644 index 000000000..896e44abc --- /dev/null +++ b/packages/vant-area-data/rslib.config.ts @@ -0,0 +1,11 @@ +import { defineConfig } from '@rslib/core'; + +export default defineConfig({ + lib: [ + { format: 'esm', syntax: ['Chrome 53'], dts: true }, + { format: 'cjs', syntax: ['Chrome 53'] }, + ], + output: { + target: 'web', + }, +}); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 44ac1bf23..8037bffb7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -127,12 +127,9 @@ importers: packages/vant-area-data: devDependencies: - esbuild: - specifier: ^0.24.0 - version: 0.24.0 - rimraf: - specifier: ^6.0.1 - version: 6.0.1 + '@rslib/core': + specifier: ^0.1.3 + version: 0.1.3(typescript@5.7.2) typescript: specifier: ^5.7.2 version: 5.7.2