fix(napcat-plugin-builtin): 修复vite.config.ts hook

This commit is contained in:
时瑾 committed 2026-01-27 20:07:53 +08:00
1 parent 7e59203232
commit 25714244dc
1 file changed
+6 -2
@@ -10,7 +10,7 @@ const nodeModules = [...builtinModules, builtinModules.map((m) => `node:${m}`)].
function copyToShellPlugin () { function copyToShellPlugin () {
return { return {
name: 'copy-to-shell', name: 'copy-to-shell',
closeBundle () { writeBundle () {
try { try {
const sourceDir = resolve(__dirname, 'dist'); const sourceDir = resolve(__dirname, 'dist');
const targetDir = resolve(__dirname, '../napcat-shell/dist/plugins/builtin'); const targetDir = resolve(__dirname, '../napcat-shell/dist/plugins/builtin');
@@ -70,7 +70,11 @@ export default defineConfig({
fileName: () => 'index.mjs', fileName: () => 'index.mjs',
}, },
rollupOptions: { rollupOptions: {
external: [...nodeModules], external: (id) => {
if (nodeModules.includes(id)) return true;
if (id.startsWith('napcat-')) return true;
return false;
},
}, },
}, },
plugins: [nodeResolve(), copyToShellPlugin()], plugins: [nodeResolve(), copyToShellPlugin()],