@@ -10,7 +10,7 @@ import { copyFile, mkdir } from 'fs/promises';
1010import { glob } from 'glob' ;
1111import * as path from 'path' ;
1212
13- const REPO_ROOT = path . join ( __dirname ) ;
13+ const REPO_ROOT = import . meta . dirname ;
1414const isWatch = process . argv . includes ( '--watch' ) ;
1515const isDev = process . argv . includes ( '--dev' ) ;
1616const isPreRelease = process . argv . includes ( '--prerelease' ) ;
@@ -122,10 +122,10 @@ const sanityTestBundlePlugin: esbuild.Plugin = {
122122} ;
123123
124124const importMetaPlugin : esbuild . Plugin = {
125- name : 'claudeCodeImportMetaPlugin ' ,
125+ name : 'claudeAgentSdkImportMetaPlugin ' ,
126126 setup ( build ) {
127- // Handle import.meta.url in @anthropic -ai/claude-code package
128- build . onLoad ( { filter : / n o d e _ m o d u l e s [ \/ \\ ] @ a n t h r o p i c - a i [ \/ \\ ] c l a u d e - c o d e [ \/ \\ ] .* \. m j s $ / } , async ( args ) => {
127+ // Handle import.meta.url in @anthropic -ai/claude-agent-sdk package
128+ build . onLoad ( { filter : / n o d e _ m o d u l e s [ \/ \\ ] @ a n t h r o p i c - a i [ \/ \\ ] c l a u d e - a g e n t - s d k [ \/ \\ ] .* \. m j s $ / } , async ( args ) => {
129129 const contents = await fs . promises . readFile ( args . path , 'utf8' ) ;
130130 return {
131131 contents : contents . replace (
@@ -251,8 +251,8 @@ const nodeSimulationWorkbenchUIBuildOptions = {
251251
252252async function typeScriptServerPluginPackageJsonInstall ( ) : Promise < void > {
253253 await mkdir ( './node_modules/@vscode/copilot-typescript-server-plugin' , { recursive : true } ) ;
254- const source = path . join ( __dirname , './src/extension/typescriptContext/serverPlugin/package.json' ) ;
255- const destination = path . join ( __dirname , './node_modules/@vscode/copilot-typescript-server-plugin/package.json' ) ;
254+ const source = path . join ( import . meta . dirname , './src/extension/typescriptContext/serverPlugin/package.json' ) ;
255+ const destination = path . join ( import . meta . dirname , './node_modules/@vscode/copilot-typescript-server-plugin/package.json' ) ;
256256 try {
257257 await copyFile ( source , destination ) ;
258258 } catch ( error ) {
@@ -369,7 +369,7 @@ async function main() {
369369}
370370
371371function applyPackageJsonPatch ( isPreRelease : boolean ) {
372- const packagejsonPath = path . join ( __dirname , './package.json' ) ;
372+ const packagejsonPath = path . join ( import . meta . dirname , './package.json' ) ;
373373 const json = JSON . parse ( fs . readFileSync ( packagejsonPath ) . toString ( ) ) ;
374374
375375 const newProps : any = {
0 commit comments