Open benmonro opened 4 years ago
@kentcdodds curious if you have thoughts on if this is possible and if so if you'd be ok with it, super low priority but wondering what you think...
I don't have a problem with this conceptually, but I don't know how this would be accomplished. I don't think it's reasonably possible.
Supposedly lodash does it... Testcafe uses that as their example. I'll do some digging.
Wouldn't be possible to check if based on the user agent? If DOM Testing Library is running in jsdom
it has a specific user agent name, if I remember correctly. Node maybe by the existence of process
-global?
Right, but then what would we do with that information? How would we load the right thing dynamically in an environment that doesn't have a bundler/esmodules?
Describe the feature you'd like:
According to this comment: https://github.com/DevExpress/testcafe/issues/4176#issuecomment-523916838 it may be possible for dom testing library to detect if its being used in node or in a browser.
The feature I'm requesting is to have it use the UMD module if it's in the browser and if not the existing main.
Suggested implementation:
🤔
Describe alternatives you've considered:
Teachability, Documentation, Adoption, Migration Strategy:
would not break anything, would just allow main to be used in the browser (via umd)
This will help w/ client script injection for testcafe testing library and make it a bit easier to inject DTL on the page.