Skip to content

Conversation

@nwalters512
Copy link
Contributor

This is necessary for Node and similar environments to treat the contents of the esm directory as ES Modules. Otherwise both Node and TypeScript get quite confused.

This is a step in the right direction of resolving #6797. After this change, one should be able to write the following in a TypeScript file:

import ModalDialog from `react-bootstrap/esm/ModalDialog.js`;

function MyComponent() {
  return <ModalDialog></ModalDialog>;
}

Importing e.g. react-bootstrap/ModalDialog doesn't yet work. And the above still doesn't work at runtime because the code in esm/ModalDialog.js isn't actually valid ESM, as it doesn't use extensions on its imports. I'd like to work towards resolving these issues in future PRs, as they're blocking the use of react-bootstrap in my application.

@kyletsang
Copy link
Member

Thanks for the PR. I'm going to be looking into adding proper support for this in the near future as part of a v3 release. Still taking care of some maintenance and upstream deps before doing so

@nwalters512
Copy link
Contributor Author

That's fantastic to hear! Let me know if you want a sounding board for any plans there, I've helped fix up several other dependencies of mine that don't quite do the right thing at the intersection of ESM/Node/TypeScript.

@reteps
Copy link

reteps commented Jun 26, 2025

Any progress on this?

@kyletsang
Copy link
Member

Any progress on this?

See #6939

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants