diff --git a/packages/cli/src/commands/migrate/packageExports.ts b/packages/cli/src/commands/migrate/packageExports.ts index 9d5c6d6339..51dc5c38bd 100644 --- a/packages/cli/src/commands/migrate/packageExports.ts +++ b/packages/cli/src/commands/migrate/packageExports.ts @@ -30,7 +30,10 @@ export async function command() { await Promise.all( packages.map(async ({ dir, packageJson }) => { - let { exports: exp } = packageJson; + let changed = false; + let newPackageJson = packageJson; + + let { exports: exp } = newPackageJson; if (!exp) { return; } @@ -38,9 +41,6 @@ export async function command() { throw new Error('Unexpected array in package.json exports field'); } - let changed = false; - let newPackageJson = packageJson; - // If exports is a string we rewrite it to an object to add package.json if (typeof exp === 'string') { changed = true;