swc as a javascript parser
See original GitHub issueFeature 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:
- Created 2 years ago
- Reactions:37
- Comments:21 (10 by maintainers)
Top GitHub Comments
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.
@alexander-akait Of course, I’d be happy to make it faster.