mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-27 12:13:27 -07:00
fix(devtools): bundle devtools package to avoid resolution errors (#27250)
This commit is contained in:
committed by
GitHub
parent
ec4910f0bb
commit
124539b5cc
+9
-1
@@ -63,7 +63,6 @@ const external = [
|
||||
'@lydell/node-pty-win32-arm64',
|
||||
'@lydell/node-pty-win32-x64',
|
||||
'@github/keytar',
|
||||
'@google/gemini-cli-devtools',
|
||||
];
|
||||
|
||||
const baseConfig = {
|
||||
@@ -110,6 +109,10 @@ const cliConfig = {
|
||||
__dirname,
|
||||
'packages/cli/src/patches/http-proxy-agent.ts',
|
||||
),
|
||||
'@google/gemini-cli-devtools': path.resolve(
|
||||
__dirname,
|
||||
'packages/devtools/src/index.ts',
|
||||
),
|
||||
...commonAliases,
|
||||
},
|
||||
metafile: true,
|
||||
@@ -117,6 +120,9 @@ const cliConfig = {
|
||||
|
||||
const workerConfig = {
|
||||
...baseConfig,
|
||||
banner: {
|
||||
js: `const require = (await import('node:module')).createRequire(import.meta.url); const __chunk_filename = (await import('node:url')).fileURLToPath(import.meta.url); const __chunk_dirname = (await import('node:path')).dirname(__chunk_filename);`,
|
||||
},
|
||||
entryPoints: {
|
||||
'worker/worker-entry': path.join(
|
||||
path.dirname(require.resolve('ink')),
|
||||
@@ -125,6 +131,8 @@ const workerConfig = {
|
||||
},
|
||||
outdir: 'bundle',
|
||||
define: {
|
||||
__filename: '__chunk_filename',
|
||||
__dirname: '__chunk_dirname',
|
||||
'process.env.NODE_ENV': JSON.stringify(
|
||||
process.env.NODE_ENV || 'production',
|
||||
),
|
||||
|
||||
@@ -85,29 +85,7 @@ if (existsSync(builtinSkillsSrc)) {
|
||||
console.log('Copied built-in skills to bundle/builtin/');
|
||||
}
|
||||
|
||||
// 5. Copy DevTools package so the external dynamic import resolves at runtime
|
||||
const devtoolsSrc = join(root, 'packages/devtools');
|
||||
const devtoolsDest = join(
|
||||
bundleDir,
|
||||
'node_modules',
|
||||
'@google',
|
||||
'gemini-cli-devtools',
|
||||
);
|
||||
const devtoolsDistSrc = join(devtoolsSrc, 'dist');
|
||||
if (existsSync(devtoolsDistSrc)) {
|
||||
mkdirSync(devtoolsDest, { recursive: true });
|
||||
cpSync(devtoolsDistSrc, join(devtoolsDest, 'dist'), {
|
||||
recursive: true,
|
||||
dereference: true,
|
||||
});
|
||||
copyFileSync(
|
||||
join(devtoolsSrc, 'package.json'),
|
||||
join(devtoolsDest, 'package.json'),
|
||||
);
|
||||
console.log('Copied devtools package to bundle/node_modules/');
|
||||
}
|
||||
|
||||
// 6. Copy bundled chrome-devtools-mcp
|
||||
// 5. Copy bundled chrome-devtools-mcp
|
||||
const bundleMcpSrc = join(root, 'packages/core/dist/bundled');
|
||||
const bundleMcpDest = join(bundleDir, 'bundled');
|
||||
if (!existsSync(bundleMcpSrc)) {
|
||||
@@ -120,7 +98,7 @@ if (!existsSync(bundleMcpSrc)) {
|
||||
cpSync(bundleMcpSrc, bundleMcpDest, { recursive: true, dereference: true });
|
||||
console.log('Copied bundled chrome-devtools-mcp to bundle/bundled/');
|
||||
|
||||
// 7. Copy Extension Examples
|
||||
// 6. Copy Extension Examples
|
||||
const extensionExamplesSrc = join(
|
||||
root,
|
||||
'packages/cli/src/commands/extensions/examples',
|
||||
|
||||
Reference in New Issue
Block a user