modern.js icon indicating copy to clipboard operation
modern.js copied to clipboard

[Feature]: Provide options to force use swc and specify swc configuration for modern.js modules

Open kirainmoe opened this issue 1 year ago • 1 comments

What problem does this feature solve?

According to this document, modern.js modules use esbuild as default js/ts transpiler, and will use swc to replace esbuild only in specific scenarios.

I wonder that is there any chance we can make modern.js module force using swc as transpiler by enabling an option, given that esbuild has some limitations, for example it can not preserve comments in bundle output. And it would be better if users can customize swc configuration.

What does the proposed API look like?

Like esbuildOptions, add an option names swc:

swc?: {
    force?: boolean;
    options?: SwcOptions; // follow swc officical schema: https://swc.rs/docs/configuration/compilation
}

kirainmoe avatar Feb 18 '24 15:02 kirainmoe

Welcome PR

10Derozan avatar Mar 19 '24 06:03 10Derozan