question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Browser/webpack support?

See original GitHub issue

I assume this is being used in https://dsherret.github.io/ts-ast-viewer

I’m trying to make something similar-ish, but the fs dependency required by ast.addSourceFileFromText() means it’s not so straightforward to implement in a browser. I’ve tried using browserfs to override it but am now getting different errors - _os.platform is not a function

Am I missing an obvious solution here? Thanks

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:16 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ben-x9commented, Apr 24, 2022

Works with these webpack settings:

{
  module: {
    rules: [
      {
        test: /node_modules[\\|/]code-block-writer[\\|/]umd[\\|/]/,
        use: { loader: "umd-compat-loader" },
      }
    ],
    noParse: [
      require.resolve("@ts-morph/common/dist/typescript.js")
    ]
  },
}
1reaction
peterjecommented, Mar 11, 2022

@jasonkuhrt @dsherret Any update on this? @ts-morph/bootstrap works with NextJS without a hitch. ts-morph will not run.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Concepts - webpack
Browser Compatibility. Webpack supports all browsers that are ES5-compliant (IE8 and below are not supported). Webpack needs Promise for import ...
Read more >
Webpacker: Configuring browser compatibility - makandra dev
Depending on what browser a project needs to support, the final Webpack output needs to be different. E.g. when we need to support...
Read more >
Browser Bundling with Webpack — Paul Everitt documentation
In this section we look at using Webpack to bundle our modular, CommonJS code into a single file fit for the browser. Along...
Read more >
browserslist: What Browsers do you need to Support?
It looks like your browser may not support the H264 codec. ... Stop and restart Webpack to force a rebuild and make sure...
Read more >
Serve modern code to modern browsers for faster page loads
Since webpack is used in this application, any changes made to the code ... Each major browser is always at a different stage...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found