mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
📦 Release qwen-code CLI as a Standalone Bundled Package (#866)
This commit is contained in:
29
scripts/esbuild-shims.js
Normal file
29
scripts/esbuild-shims.js
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2025 Qwen
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Shims for esbuild ESM bundles to support require() calls
|
||||
* This file is injected into the bundle via esbuild's inject option
|
||||
*/
|
||||
|
||||
import { createRequire } from 'node:module';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { dirname } from 'node:path';
|
||||
|
||||
// Create require function for the current module and make it global
|
||||
const _require = createRequire(import.meta.url);
|
||||
|
||||
// Make require available globally for dynamic requires
|
||||
if (typeof globalThis.require === 'undefined') {
|
||||
globalThis.require = _require;
|
||||
}
|
||||
|
||||
// Export for esbuild injection
|
||||
export const require = _require;
|
||||
|
||||
// Setup __filename and __dirname for compatibility
|
||||
export const __filename = fileURLToPath(import.meta.url);
|
||||
export const __dirname = dirname(__filename);
|
||||
Reference in New Issue
Block a user