Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minification could be improved? #1371

Closed
kaushalyap opened this issue Jan 31, 2021 · 4 comments · Fixed by #1978
Closed

Minification could be improved? #1371

kaushalyap opened this issue Jan 31, 2021 · 4 comments · Fixed by #1978
Milestone

Comments

@kaushalyap
Copy link

As seen in https://github.com/privatenumber/minification-benchmarks SWC minfication ability is comparatively low. Can this be improved?

@kdy1
Copy link
Member

kdy1 commented Jan 31, 2021

I'm already working on it.
See: #1302
I'm basically porting terser, with some additional rules from closure compiler.

@kdy1
Copy link
Member

kdy1 commented Jan 31, 2021

I made an issue about it at privatenumber/minification-benchmarks#6

@IllusionPerdu
Copy link

I see the code for the benchmark for the esbuild is

import esbuild from 'esbuild';
import measure from './measure.js';

const service = await esbuild.startService();

await measure(async ({ code }) => {
	const minified = (await service.transform(code, {
		minify: true,
		sourcemap: false,
	}));
	return minified.code;
});

service.stop();

I think it would be nice to do the equivalent of the "esbuild.startService" function to initialize the wasm of swc.
This would allow the performance of swc to be measured without loading the wasm.

@kdy1 kdy1 added this to the v1.2.67 milestone Jul 31, 2021
kdy1 added a commit that referenced this issue Jul 31, 2021
swc_ecma_codegen:
 - Fix codegen of imports when minification is enabled.

swc_ecma_minifier:
 - Mangle identifiers used by imports.

swc:
 - Support specifing `jsc.minify`. (#704, #1371)

swc/node:
 - Add `.minify()`.
 - Add `.minifySync()`.

swc/wasm:
 - Add `.minifySync()`.
@swc-bot
Copy link
Collaborator

swc-bot commented Oct 23, 2022

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@swc-project swc-project locked as resolved and limited conversation to collaborators Oct 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging a pull request may close this issue.

4 participants