Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace invalid variable characters for import name (#4293)
Summary: Closes: #4294 When using provided variables, with ESM, the Relay compiler incorrectly assumes that the module path can also be reused for the default import name. This is not valid Javascript as variables cannot use '.' or '-' characters. To fix, simply replace '.' and '-' with underscores. Before: ``` import include-can-edit-providers-three.relayprovider from './../include-can-edit-providers-three.relayprovider'; import include-can-edit-providers.relayprovider from './../include-can-edit-providers.relayprovider'; const providedVariablesDefinition: ProvidedVariablesType = { "__relay_internal__pv__includecaneditprovidersrelayprovider": include-can-edit-providers-three.relayprovider, "__relay_internal__pv__includecaneditprovidersthreerelayprovider": include-can-edit-providers.relayprovider }; ``` After: ``` import include_can_edit_providers_two_relayprovider from './../include-can-edit-providers-two.relayprovider'; import include_can_edit_providers_relayprovider from './../include-can-edit-providers.relayprovider'; const providedVariablesDefinition: ProvidedVariablesType = { "__relay_internal__pv__includecaneditprovidersrelayprovider": include_can_edit_providers_relayprovider, "__relay_internal__pv__includecaneditproviderstworelayprovider": include_can_edit_providers_two_relayprovider }; ``` I'm unfamiliar with Rust so am unsure if there is a better approach. Pull Request resolved: #4293 Reviewed By: tyao1 Differential Revision: D46360937 Pulled By: captbaritone fbshipit-source-id: bb8383f0fd97a8510ccf4dff29eefbaddee33be1
- Loading branch information