facebook / metro

🚇 The JavaScript bundler for React Native
https://metrobundler.dev
MIT License
5.25k stars 626 forks source link

Move `metro-minify-terser` dependency to `metro-transform-worker`, fix pnpm (etc) resolution #1199

Closed robhogan closed 10 months ago

robhogan commented 10 months ago

Summary: Related: https://github.com/facebook/metro/pull/1172

This is the minimally invasive change to fix resolution of the default minifierPath: 'metro-minify-terser', especially under isolated node_modules layouts.

minifierPath is required/resolved only from metro-transform-worker:

Per the current docs for minifierPath, a module specifier relative to metro-transform-worker is explicitly acceptable:

Type: string (default: 'metro-minify-terser') Path, or package name resolvable from metro-transform-worker, to the minifier that minifies the code after transformation.

Unlike https://github.com/facebook/metro/pull/1172 (thanks tido64 for flagging), this doesn't modify the defaults and can be released in a patch release. The approach in that PR (using fully resolved paths in config) may be the better long-term fix though, so this patch shouldn't be regarded as superseding it.

Changelog:

 - **[Fix]:** Move `metro-minify-terser` dependency to fix resolution under isolated node_modules (pnpm, etc).

Differential Revision: D53000650

facebook-github-bot commented 10 months ago

This pull request was exported from Phabricator. Differential Revision: D53000650

facebook-github-bot commented 10 months ago

This pull request has been merged in facebook/metro@8e264605b677e544ab1a203104405f3845f53371.