You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"unambiguous" - Consider the file a "module" if import/export statements are present, or else consider it a "script"
From what I'm seeing, if only type imports and exports are present, Babel 7 fails to consider the file a module. It will only consider it a module if there are value imports or exports present.
Consequently, the import t from 'flow-runtime' statement inserted by babel-plugin-flow-runtime doesn't get transpiled into a require statement if Babel fails to consider the file a module.
I don't know if there's any way we can fix this from our end.
The workaround is simple at least, just add your own import t from 'flow-runtime' declaration to the file.
This is a:
Which concerns:
Putting this summary here in case other people run into this issue, it took me lots of debugging to understand.
So even though the docs for the
sourceType
option state thatFrom what I'm seeing, if only type imports and exports are present, Babel 7 fails to consider the file a module. It will only consider it a module if there are value imports or exports present.
Consequently, the
import t from 'flow-runtime'
statement inserted bybabel-plugin-flow-runtime
doesn't get transpiled into arequire
statement if Babel fails to consider the file a module.I don't know if there's any way we can fix this from our end.
The workaround is simple at least, just add your own
import t from 'flow-runtime'
declaration to the file..babelrc
typeOnly.js
What is the current behaviour?
What is the expected behaviour?
Which package versions are you using?
The text was updated successfully, but these errors were encountered: