From 96885db65636b6bf2a8fe96aa49d5a4130a57d49 Mon Sep 17 00:00:00 2001 From: oasis <12181600+oasis-cloud@users.noreply.github.com> Date: Thu, 20 Jun 2024 14:25:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20umd=20=E4=B8=AD=E6=9B=BF=E6=8D=A2?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F=20(#2368)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 15 ++++++++------- pnpm-lock.yaml | 32 ++++++++++++++++++++++++-------- vite.config.build.ts | 5 ++++- 3 files changed, 36 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index ca4f337e8a..bb8498b313 100644 --- a/package.json +++ b/package.json @@ -99,6 +99,7 @@ "@nutui/icons-react-taro": "^1.0.4", "@nutui/touch-emulator": "^1.0.0", "@react-spring/web": "~9.6.1", + "@types/fs-extra": "^11.0.4", "@use-gesture/react": "10.2.20", "async-validator": "^4.2.5", "classnames": "^2.5.1", @@ -118,6 +119,9 @@ "@commitlint/cli": "^19.0.3", "@commitlint/config-conventional": "^19.0.3", "@loadable/component": "^5.16.3", + "@mdx-js/mdx": "^3.0.1", + "@mdx-js/react": "^3.0.1", + "@mdx-js/rollup": "^3.0.1", "@pmmmwh/react-refresh-webpack-plugin": "0.5.10", "@rollup/plugin-babel": "^6.0.4", "@rollup/plugin-commonjs": "^26.0.1", @@ -144,6 +148,8 @@ "@typescript-eslint/eslint-plugin": "^7.0.2", "@typescript-eslint/parser": "^7.0.2", "@vitejs/plugin-react": "^4.2.1", + "@vitest/coverage-v8": "^1.4.0", + "@vitest/ui": "^1.4.0", "autoprefixer": "^10.4.17", "axios": "^1.6.7", "babel-plugin-react-scoped-css": "^1.1.1", @@ -159,15 +165,13 @@ "eslint-plugin-unused-imports": "^4.0.0", "fs-extra": "^11.2.0", "glob": "^10.3.10", + "happy-dom": "^14.2.0", + "highlight.js": "^11.9.0", "husky": "^9.0.11", "inquirer": "^9.2.15", "jscodeshift": "^0.15.1", "lint-staged": "^15.2.2", "lzutf8": "0.6.3", - "@mdx-js/mdx": "^3.0.1", - "@mdx-js/react": "^3.0.1", - "@mdx-js/rollup": "^3.0.1", - "highlight.js": "^11.9.0", "map-stream": "0.0.7", "markdown-it": "^14.0.0", "marked": "^12.0.0", @@ -204,9 +208,6 @@ "vite": "^5.1.3", "vite-plugin-dts": "3.6.4", "vitest": "^1.4.0", - "@vitest/coverage-v8": "^1.4.0", - "@vitest/ui": "^1.4.0", - "happy-dom": "^14.2.0", "vitest-canvas-mock": "^0.3.3" }, "peerDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5a3d505b48..84802bc5c0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -27,6 +27,9 @@ importers: '@react-spring/web': specifier: ~9.6.1 version: 9.6.1(react-dom@18.3.1)(react@18.3.1) + '@types/fs-extra': + specifier: ^11.0.4 + version: 11.0.4 '@use-gesture/react': specifier: 10.2.20 version: 10.2.20(react@18.3.1) @@ -108,7 +111,7 @@ importers: version: 3.6.22(@types/react@18.3.3)(postcss@8.4.38)(react@18.3.1) '@tarojs/plugin-platform-alipay': specifier: 3.6.22 - version: 3.6.22(@types/react@18.3.3)(postcss@8.4.38) + version: 3.6.22(@types/react@18.3.3)(postcss@8.4.38)(react@18.3.1) '@tarojs/plugin-platform-weapp': specifier: 3.6.22 version: 3.6.22(@types/react@18.3.3)(postcss@8.4.38)(react@18.3.1) @@ -400,7 +403,7 @@ importers: version: 3.6.22(@types/react@18.3.3)(postcss@8.4.38) '@tarojs/plugin-platform-alipay': specifier: 3.6.22 - version: 3.6.22(@types/react@18.3.3)(postcss@8.4.38) + version: 3.6.22(@types/react@18.3.3)(postcss@8.4.38)(react@18.3.1) '@tarojs/plugin-platform-h5': specifier: 3.6.22 version: 3.6.22(@types/react@18.3.3)(postcss@8.4.38) @@ -409,7 +412,7 @@ importers: version: 3.6.22(@types/react@18.3.3)(postcss@8.4.38) '@tarojs/plugin-platform-qq': specifier: 3.6.22 - version: 3.6.22(@types/react@18.3.3)(postcss@8.4.38)(react@18.3.1) + version: 3.6.22(@types/react@18.3.3)(postcss@8.4.38) '@tarojs/plugin-platform-swan': specifier: 3.6.22 version: 3.6.22(@types/react@18.3.3)(postcss@8.4.38) @@ -4301,7 +4304,7 @@ packages: - vue dev: false - /@tarojs/plugin-platform-alipay@3.6.22(@types/react@18.3.3)(postcss@8.4.38): + /@tarojs/plugin-platform-alipay@3.6.22(@types/react@18.3.3)(postcss@8.4.38)(react@18.3.1): resolution: {integrity: sha512-dmhWl2BHsL1eUNjYRKrOwQJGkpdN/LGyu+++iFSM3ra8PzwaGRxq61u1LxC+7nkf8/9dJKtG5UoEoWprxQD5yg==} dependencies: '@tarojs/components': 3.6.22(@types/react@18.3.3)(postcss@8.4.38)(react@18.3.1) @@ -4314,6 +4317,7 @@ packages: - '@types/webpack' - '@types/webpack-dev-server' - postcss + - react - supports-color - vue @@ -4355,7 +4359,7 @@ packages: - supports-color - vue - /@tarojs/plugin-platform-qq@3.6.22(@types/react@18.3.3)(postcss@8.4.38)(react@18.3.1): + /@tarojs/plugin-platform-qq@3.6.22(@types/react@18.3.3)(postcss@8.4.38): resolution: {integrity: sha512-XMVvO2k3qEmNgY7lKFvwm2+JPW6m8FqvGp6n27tAlUFYEgnSH7ejyvNauKYDKbv1XZpQHPvbJE2ijq5Zdj5WKQ==} dependencies: '@tarojs/plugin-platform-weapp': 3.6.22(@types/react@18.3.3)(postcss@8.4.38)(react@18.3.1) @@ -4368,7 +4372,6 @@ packages: - '@types/webpack' - '@types/webpack-dev-server' - postcss - - react - supports-color - vue @@ -4587,9 +4590,9 @@ packages: dependencies: '@parcel/css': 1.14.0 '@tarojs/helper': 3.6.22 - '@tarojs/plugin-platform-alipay': 3.6.22(@types/react@18.3.3)(postcss@8.4.38) + '@tarojs/plugin-platform-alipay': 3.6.22(@types/react@18.3.3)(postcss@8.4.38)(react@18.3.1) '@tarojs/plugin-platform-jd': 3.6.22(@types/react@18.3.3)(postcss@8.4.38) - '@tarojs/plugin-platform-qq': 3.6.22(@types/react@18.3.3)(postcss@8.4.38)(react@18.3.1) + '@tarojs/plugin-platform-qq': 3.6.22(@types/react@18.3.3)(postcss@8.4.38) '@tarojs/plugin-platform-swan': 3.6.22(@types/react@18.3.3)(postcss@8.4.38) '@tarojs/plugin-platform-tt': 3.6.22(@types/react@18.3.3)(postcss@8.4.38) '@tarojs/plugin-platform-weapp': 3.6.22(@types/react@18.3.3)(postcss@8.4.38)(react@18.3.1) @@ -4950,6 +4953,13 @@ packages: '@types/serve-static': 1.15.7 dev: true + /@types/fs-extra@11.0.4: + resolution: {integrity: sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==} + dependencies: + '@types/jsonfile': 6.1.4 + '@types/node': 20.14.2 + dev: false + /@types/fs-extra@8.1.5: resolution: {integrity: sha512-0dzKcwO+S8s2kuF5Z9oUWatQJj5Uq/iqphEtE3GQJVRRYm/tD1LglU2UnXi2A8jLq5umkGouOXOR9y0n613ZwQ==} dependencies: @@ -5026,6 +5036,12 @@ packages: resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==} dev: true + /@types/jsonfile@6.1.4: + resolution: {integrity: sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ==} + dependencies: + '@types/node': 20.14.2 + dev: false + /@types/keyv@3.1.4: resolution: {integrity: sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==} dependencies: diff --git a/vite.config.build.ts b/vite.config.build.ts index 2e69974285..b4e83ebf7b 100644 --- a/vite.config.build.ts +++ b/vite.config.build.ts @@ -19,6 +19,9 @@ if (projectID) { } // https://vitejs.dev/config/ export default defineConfig({ + define: { + 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV), + }, resolve: { alias: [{ find: '@', replacement: resolve(__dirname, './src') }], }, @@ -73,7 +76,7 @@ export default defineConfig({ react: 'React', 'react-dom': 'ReactDOM', }, - name: 'nutui.react', + name: 'nutui', format: 'umd', entryFileNames: 'nutui.react.umd.js', },