diff --git a/metro.config.js b/metro.config.js index 5a294e105b..a498f5a209 100644 --- a/metro.config.js +++ b/metro.config.js @@ -9,6 +9,7 @@ gutenbergMetroConfigCopy.resolver.extraNodeModules = new Proxy( {}, { get: ( target, name ) => { + // Try to find the module in the Gutenberg submodule. const gutenbergFolder = path.join( process.cwd(), `gutenberg/node_modules/${ name }` @@ -17,17 +18,21 @@ gutenbergMetroConfigCopy.resolver.extraNodeModules = new Proxy( return gutenbergFolder; } - // let's try find the module in the Jetpack submodule. We'll try the .pnpm folder. + // Try to find the module in Jetpack's .pnpm folder. const moduleFolderPnpm = path.join( process.cwd(), `./jetpack/node_modules/.pnpm/node_modules/${ name }` ); - // pnpm uses symlinks so, let's find the target - const symlinkTarget = fs.readlinkSync( moduleFolderPnpm ); + if ( fs.existsSync( moduleFolderPnpm ) ) { + // pnpm uses symlinks so, let's find the target + const symlinkTarget = fs.readlinkSync( moduleFolderPnpm ); - // the target is still using paths relative to the parent folder of the module, let's find the real path. - return path.resolve( moduleFolderPnpm + '/../' + symlinkTarget ); + // the target is still using paths relative to the parent folder of the module, let's find the real path. + return path.resolve( + moduleFolderPnpm + '/../' + symlinkTarget + ); + } }, } ); diff --git a/package-lock.json b/package-lock.json index ef7bcc6414..668c712f1b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15835,11 +15835,6 @@ "integrity": "sha512-QPrWNYeE/A0xRvl/QP3E0nkaEvYUvH3gM04ZWYtIa6QlSpEetRlRI1xvQ7hiMIySHHEV+mwDSX8Kj4YZY6ZQAw==", "dev": true }, - "email-validator": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/email-validator/-/email-validator-2.0.4.tgz", - "integrity": "sha512-gYCwo7kh5S3IDyZPLZf6hSS0MnZT8QmJFqYvbqlDZSbwdZlY6QZWxJ4i/6UhITOJ4XzyI647Bm2MXKCLqnJ4nQ==" - }, "emoji-regex": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", diff --git a/package.json b/package.json index e0cdf0ec67..d6ea2ad92a 100644 --- a/package.json +++ b/package.json @@ -104,7 +104,5 @@ "lint:fix": "npm run lint -- --fix", "version": "npm run bundle && git add -A bundle" }, - "dependencies": { - "email-validator": "2.0.4" - } + "dependencies": {} }