Support loading ts-morph via esm.sh
Open
enhancement
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 238
- Avg merge
- 2m
- Merged PRs (30d)
- 1
Description
**Describe the bug**
Version: 10.0.2
When loading ts-morph@10.0.2 in the browser via ESM import, it gives an error "require is not defined", pointing at `this.fs = require("fs")`.
If you pin to ts-morph@10.0.1, it works fine.
**To Reproduce**
https://codesandbox.io/s/stoic-dewdney-blqc3?file=/index.html
The sandbox shows the error. If you change the `10.0.2` to `10.0.1` inside `index.html` and reload the output, it works.
**Expected behavior**
You can load ts-morph in the browser from a ES module CDN.
Contributor guide
Assessment
This issue has not been assessed yet.