Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/good-mirrors-bow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@callstack/repack": patch
---

Fix failure to read project package json when validating plugins
6 changes: 4 additions & 2 deletions packages/repack/src/commands/common/config/validatePlugins.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import fs from 'node:fs';
import path from 'node:path';
import { bold } from 'colorette';

Expand Down Expand Up @@ -34,8 +35,9 @@ export async function validatePlugins(
);

try {
const packageJson = require(path.join(rootDir, 'package.json'));
dependencies = Object.keys(packageJson.dependencies || {});
const packageJsonPath = path.join(rootDir, 'package.json');
const packageJson = fs.readFileSync(packageJsonPath, 'utf-8');
dependencies = Object.keys(JSON.parse(packageJson).dependencies || {});
} catch (error) {
if ((error as NodeJS.ErrnoException).code === 'ENOENT') {
console.debug(
Expand Down