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.

swc as a javascript parser

See original GitHub issue

Feature request

Follow up of https://github.com/webpack/webpack/discussions/13408#discussioncomment-760254

I’m author of the swc project and I’m looking for way to improve the performance of webpack.

Parsing something in javascript is a very expensive task, so I think using the parser of swc with libuv worker thread will improve performance a lot. (Also, it does not block js thread, so other codes can run while parsing.)

But currently, webpack does not allow overriding dependency analysis and it seems like I have to reimplement the whole JavascriptPlugin. If there’s an easier way to improve performance, it would be great.

I’ll create a standalone parser package if required.

What is the expected behavior?

Returning dependency graph from a loader.

What is motivation or use case for adding/changing the behavior?

Huge performance improvements.

How should this be implemented in your opinion?

By returning graph object or list from a loader.

Are you willing to work on this yourself?

Yes.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:37
  • Comments:21 (10 by maintainers)

github_iconTop GitHub Comments

4reactions
kdy1commented, Jan 15, 2022

Yeah actually I made rust module that can generate acorn AST from source code. I’ll check how it performs using swc-loader first. Of course, it has start/end/loc/comments/etc… We need benchmark, but definitely worth trying.

3reactions
kdy1commented, Sep 12, 2021

@alexander-akait Of course, I’d be happy to make it faster.

Read more comments on GitHub >

github_iconTop Results From Across the Web

swc-project/swc: Rust-based platform for the Web - GitHub
SWC (stands for Speedy Web Compiler ) is a super-fast TypeScript / JavaScript compiler written in Rust. It's a library for Rust and...
Read more >
SWC: Rust-based platform for the Web
SWC is an extensible Rust-based platform for the next generation of fast developer tools. It's used by tools like Next.js, Parcel, and Deno, ......
Read more >
swcmorphologyparser - npm
An instance of SwcParser is made to parse SWC files with the given specification. The data output by this parser is a Javascript...
Read more >
Why you should use SWC (and not Babel) - LogRocket Blog
First, Babel's parser takes the JavaScript code and converts it to an ... SWC is also a transpiler for JavaScript, it is written...
Read more >
How to print a JavaScript AST using SWC and Rust
javascript. Copy. import Thing from "a-place";. export const Something = {. some: "object",. };. We can use swc to parse the source file...
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