Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing dependency on metro-transform-worker #817

Closed
wants to merge 1 commit into from

Conversation

robhogan
Copy link
Contributor

@robhogan robhogan commented May 7, 2022

Summary:
Currently, metro-config calls require.resolve('metro-transform-worker') to establish the default value for transformerPath. However, metro-config doesn't list metro-transform-worker as a dependency, so this fails when metro-config is used as a standalone package.

It isn't strictly necessary for this value to be an an absolute path in the current implementation - it just needs to be require-able from within metro (specifically DeltaBundler/Worker.js).

This diff documents that transformerPath may be a package name, and changes to the default config to just use the default package name metro-transform-worker, removing the dependency.

Fixes #805

Differential Revision: D36208763

Summary:
Currently, `metro-config` calls `require.resolve('metro-transform-worker')` to establish the default value for `transformerPath`. However, `metro-config` doesn't list `metro-transform-worker` as a dependency, so this fails when `metro-config` is used as a standalone package.

It isn't strictly necessary for this value to be an an absolute path in the current implementation - it just needs to be `require`-able from within `metro` (specifically [`DeltaBundler/Worker.js`](https://github.com/facebook/metro/blob/347b1d7ed87995d7951aaa9fd597c04b06013dac/packages/metro/src/DeltaBundler/Worker.js#L61-L64)).

This diff documents that `transformerPath` may be a package name, and changes to the default config to just use the default package name `metro-transform-worker`, removing the dependency.

Fixes facebook#805

Differential Revision: D36208763

fbshipit-source-id: 096c85f6aa10d7ed64eb7059dcab377de270f3a9
@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported labels May 7, 2022
@facebook-github-bot
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing dependency on metro-transform-worker
2 participants