This pull request changes the variable declaration for _components and destructured component identifiers (which must be passed via props), to use let instead of const.
let _components = Object.assign({
h1: "h1",
}, _provideComponents(), props.components)
, {MyComponent} = _components;
if (!MyComponent)
_missingMdxReference("MyComponent", true)
which would allow a recma plugin to walk through _missingMdxReference calls and replace the call with an assignment of the call expression:
if (!MyComponent)
MyComponent = _missingMdxReference("MyComponent", true)
Considerations
Replacing const with let shouldn't have any practical downsides.
I though about adding the assignment in this pull request, but it increases the output size and it doesn't serve a purpose without additional transformations, so that is definitely a downside.
Description 📖
This pull request changes the variable declaration for
_components
and destructured component identifiers (which must be passed via props), to uselet
instead ofconst
.This is part 1 of the discussed changes to facilitate individual component resolution in Vue (or other frameworks).
Why? 🤔
By using
let
instead ofconst
, it enables re-assignment of the destructured components:Before
After
which would allow a recma plugin to walk through
_missingMdxReference
calls and replace the call with an assignment of the call expression:Considerations
Replacing
const
withlet
shouldn't have any practical downsides.I though about adding the assignment in this pull request, but it increases the output size and it doesn't serve a purpose without additional transformations, so that is definitely a downside.