Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Catch exceptions in Transformer construction (#351)
Summary: **Summary** When transformerPath is set in metro.config.js, if there is a failure in loading the custom transformer, the exception is silently swallowed and all the user sees is this misleading error message (see below). In this patch, we add a catch to the promise to report the original exception to the user. **Test plan** Set an invalid transformerPath in metro.config.js to reproduce: ``` module.exports = { transformerPath: require.resolve('./fail.js'), } ``` ```text Cannot read property 'transformFile' of undefined TypeError: Cannot read property 'transformFile' of undefined at /Users/go/Library/Application Support/Go Agent/pipelines/ngf-app-ios/node_modules/react-native/node_modules/metro/src/Bundler.js:83:34 at Generator.next (<anonymous>) at asyncGeneratorStep (/Users/go/Library/Application Support/Go Agent/pipelines/ngf-app-ios/node_modules/react-native/node_modules/metro/src/Bundler.js:14:24) at _next (/Users/go/Library/Application Support/Go Agent/pipelines/ngf-app-ios/node_modules/react-native/node_modules/metro/src/Bundler.js:34:9) ``` Pull Request resolved: #351 Differential Revision: D13898317 Pulled By: rafeca fbshipit-source-id: 6778b3b96e00a74bf985ea88575f7315a159b77f
- Loading branch information