From 6d09a6aff858845cc9371c7a8bcd3baff21b5eb9 Mon Sep 17 00:00:00 2001 From: alan <741484865@qq.com> Date: Fri, 16 Aug 2024 16:03:12 +0800 Subject: [PATCH] =?UTF-8?q?hi-cocos=20=E4=BE=9D=E8=B5=96=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 62 +++++++++++-------------------- packages/hello-build/package.json | 13 +++---- packages/hello-build/src/core.js | 5 +-- 3 files changed, 29 insertions(+), 51 deletions(-) diff --git a/package-lock.json b/package-lock.json index 19de077..b982795 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4803,14 +4803,6 @@ "node": ">=10" } }, - "node_modules/flat": { - "version": "5.0.2", - "resolved": "https://registry.npmmirror.com/flat/-/flat-5.0.2.tgz", - "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", - "bin": { - "flat": "cli.js" - } - }, "node_modules/flat-cache": { "version": "3.2.0", "resolved": "https://registry.npmmirror.com/flat-cache/-/flat-cache-3.2.0.tgz", @@ -8404,12 +8396,12 @@ } }, "node_modules/vite": { - "version": "5.4.0", - "resolved": "https://registry.npmmirror.com/vite/-/vite-5.4.0.tgz", - "integrity": "sha512-5xokfMX0PIiwCMCMb9ZJcMyh5wbBun0zUzKib+L65vAZ8GY9ePZMXxFrHbr/Kyll2+LSCY7xtERPpxkBDKngwg==", + "version": "5.4.1", + "resolved": "https://registry.npmmirror.com/vite/-/vite-5.4.1.tgz", + "integrity": "sha512-1oE6yuNXssjrZdblI9AfBbHCC41nnyoVoEZxQnID6yvQZAFBzxxkqoFLtHUMkYunL8hwOLEjgTuxpkRxvba3kA==", "dependencies": { "esbuild": "^0.21.3", - "postcss": "^8.4.40", + "postcss": "^8.4.41", "rollup": "^4.13.0" }, "bin": { @@ -8720,19 +8712,6 @@ "integrity": "sha512-PgF341avzqyx60neE9DD+XS26MMNMoUQRz9NOZwW32nPQrF6p77f1htcnjBSEV8BGMKZ16choqUG4hyI0Hx7mA==", "dev": true }, - "node_modules/webpack-merge": { - "version": "5.10.0", - "resolved": "https://registry.npmmirror.com/webpack-merge/-/webpack-merge-5.10.0.tgz", - "integrity": "sha512-+4zXKdx7UnO+1jaN4l2lHVD+mFvnlZQP/6ljaJVb4SZiwIKeUnrT5l0gkT8z+n4hKpC+jpOv6O9R+gLtag7pSA==", - "dependencies": { - "clone-deep": "^4.0.1", - "flat": "^5.0.2", - "wildcard": "^2.0.0" - }, - "engines": { - "node": ">=10.0.0" - } - }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmmirror.com/which/-/which-2.0.2.tgz", @@ -8762,11 +8741,6 @@ "node": ">= 0.4" } }, - "node_modules/wildcard": { - "version": "2.0.1", - "resolved": "https://registry.npmmirror.com/wildcard/-/wildcard-2.0.1.tgz", - "integrity": "sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==" - }, "node_modules/wrap-ansi": { "version": "8.1.0", "resolved": "https://registry.npmmirror.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz", @@ -9152,21 +9126,18 @@ "name": "@cocos-fe/hello-build", "version": "1.0.0", "dependencies": { - "@vitejs/plugin-vue": "^5.0.4", + "@vitejs/plugin-vue": "^5.1.2", "@vitejs/plugin-vue2": "^2.3.1", "chokidar": "^3.6.0", - "commander": "^12.0.0", + "commander": "^12.1.0", "less": "^4.2.0", - "vite": "^5.2.6", - "webpack-merge": "^5.10.0" + "rollup-plugin-node-externals": "^7.1.2", + "vite": "^5.4.1" }, "bin": { "hi-cocos": "src/index.js", "hi-cocos-icns": "shell/icns.sh" }, - "devDependencies": { - "rollup-plugin-node-externals": "^7.1.1" - }, "engines": { "node": ">=18" } @@ -9198,13 +9169,24 @@ } }, "packages/hello-build/node_modules/commander": { - "version": "12.0.0", - "resolved": "https://registry.npmmirror.com/commander/-/commander-12.0.0.tgz", - "integrity": "sha512-MwVNWlYjDTtOjX5PiD7o5pK0UrFU/OYgcJfjjK4RaHZETNtjJqrZa9Y9ds88+A+f+d5lv+561eZ+yCKoS3gbAA==", + "version": "12.1.0", + "resolved": "https://registry.npmmirror.com/commander/-/commander-12.1.0.tgz", + "integrity": "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==", "engines": { "node": ">=18" } }, + "packages/hello-build/node_modules/rollup-plugin-node-externals": { + "version": "7.1.2", + "resolved": "https://registry.npmmirror.com/rollup-plugin-node-externals/-/rollup-plugin-node-externals-7.1.2.tgz", + "integrity": "sha512-cVJFKs+ulZxpMmn/s+oi431d93Jq5+G7Sc5ixWDrL2k+Gj+MqXg0KMNWgKf8Mw5qpaG4jVDpsvuqFfiCvRcGeA==", + "engines": { + "node": ">= 21 || ^20.6.0 || ^18.19.0" + }, + "peerDependencies": { + "rollup": "^3.0.0 || ^4.0.0" + } + }, "packages/unzip": { "dependencies": { "extract-zip": "^2.0.1" diff --git a/packages/hello-build/package.json b/packages/hello-build/package.json index 14bceaf..3061b90 100644 --- a/packages/hello-build/package.json +++ b/packages/hello-build/package.json @@ -1,6 +1,6 @@ { "name": "@cocos-fe/hello-build", - "version": "1.0.0", + "version": "1.0.1", "description": "cocos editor 插件构建工具", "type": "module", "module": "src/core.js", @@ -14,13 +14,13 @@ "hi-cocos-icns": "shell/icns.sh" }, "dependencies": { - "@vitejs/plugin-vue": "^5.0.4", + "@vitejs/plugin-vue": "^5.1.2", "@vitejs/plugin-vue2": "^2.3.1", "chokidar": "^3.6.0", - "commander": "^12.0.0", + "commander": "^12.1.0", "less": "^4.2.0", - "vite": "^5.2.6", - "webpack-merge": "^5.10.0" + "rollup-plugin-node-externals": "^7.1.2", + "vite": "^5.4.1" }, "publishConfig": { "access": "public", @@ -29,9 +29,6 @@ "engines": { "node": ">=18" }, - "devDependencies": { - "rollup-plugin-node-externals": "^7.1.1" - }, "files": [ "src", "shell", diff --git a/packages/hello-build/src/core.js b/packages/hello-build/src/core.js index 0bfc702..822bcf4 100644 --- a/packages/hello-build/src/core.js +++ b/packages/hello-build/src/core.js @@ -1,10 +1,9 @@ -import { build, defineConfig } from 'vite'; +import { build, defineConfig, mergeConfig } from 'vite'; import vue from '@vitejs/plugin-vue'; import vue2 from '@vitejs/plugin-vue2'; import { resolve } from 'path'; import { statSync, existsSync } from 'fs'; import { nodeExternals } from 'rollup-plugin-node-externals'; -import { merge } from 'webpack-merge'; import { pathToFileURL } from 'node:url'; export { defineConfig } from 'vite'; @@ -58,7 +57,7 @@ export function createViteBuild(taskConfig) { // 原则上,这些配置应该是由外面传进来,内部不做 default 的配置,已达到灵活的定制需求 // 但是我们业务形态比较固定,灵活性 < 简单化 - const c = merge( + const c = mergeConfig( defineConfig({ plugins: plugins, base: './',