dsherret / dsherret/ts-morph

Support loading ts-morph via esm.sh

Open
#956 5 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.