swc
swc copied to clipboard
Could `minify()` support `module: "unknown"`?
Describe the feature
I'm working on migrating a large codebase from Terser to SWC for minification. We have a mix of scripts and modules in our output. Most of the time we can differentiate between them based on their file extension (.js
vs .mjs
) and use that to set minify()
's module
option correctly. I'm finding that we have a handful of files with a .js
extension that are actually modules. Terser seems to process the module files without failing even when module
is set to false
. SWC (understandably) fails.
Would it be possible to add an "unknown"
option to minify()
similar to transform()
's isModule
?
Related:
- https://github.com/swc-project/swc/issues/2541
- https://github.com/swc-project/swc/issues/3493
Babel plugin or link to the feature description
No response
Additional context
No response