🐛 Bug Report
I'm working in an ES2017 codebase compiled with TypeScript, Babel, and webpack. It seems that in certain contexts, using the default import of FBT fails because babel-plugin-fbt says the variable fbt is not bound when using the fbt() syntax in code. Examining the value of the import, is an object with this structure:
{
__esModule: true,
FbtTranslations: { /* ... */ },
GenderConst: { /* ... */ },
default: f (),
fbt: f (),
init: f (e),
}
I'm not sure which step of tooling is responsible for making the default export an object.
I've confirmed that a reliable workaround is to write const { fbt } = require('fbt') rather than const fbt = require('fbt').
I believe that the fault lies in babel-plugin-fbt, since I am able to use the default exports of other libraries without issue.
To Reproduce
Not certain what the minimal replication case is.
Expected behavior
When using TypeScript and/or webpack, FBT should work reliably when using the default export.
envinfo
System:
OS: macOS Sierra 10.12.6
CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Memory: 288.96 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.12.0 - ~/.nvm/versions/node/v12.12.0/bin/node
Yarn: 1.19.1 - /usr/local/bin/yarn
npm: 6.11.3 - ~/.nvm/versions/node/v12.12.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman