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

Move from terser to esbuild #2987

Open
baseplate-admin opened this issue Sep 15, 2023 · 7 comments
Open

Move from terser to esbuild #2987

baseplate-admin opened this issue Sep 15, 2023 · 7 comments
Labels

Comments

@baseplate-admin
Copy link

baseplate-admin commented Sep 15, 2023

What pain point are you perceiving?.
it seems that marked is using terser for bundling

import terser from '@rollup/plugin-terser';

plugins: [terser()]

But terser is slower ( about 10x ) than esbuild.

Describe the solution you'd like
It would be better if marked moved to esbuild + rollup ( or maybe vite ) for it's bundling process.

Rollup has : rollup-plugin-esbuild

Vite natively supports esbuild

@UziTech
Copy link
Member

UziTech commented Sep 15, 2023

I don't feel like our build times are a problem. They are only a couple seconds currently. I went with terser because the plugin is developed by rollup and more likely to continue being supported than a plugin created by a lone developer.

I'm ok with either. It should be easy to switch in the future if needed.

@baseplate-admin
Copy link
Author

baseplate-admin commented Sep 16, 2023

I don't feel like our build times are a problem. They are only a couple seconds currently.

True, but esbuild gets more attention than terser because vite (and a lot of major frameworks) are using esbuild.

I went with terser because the plugin is developed by rollup and more likely to continue being supported than a plugin created by a lone developer.

Then why not switch to vite in library mode?

@UziTech
Copy link
Member

UziTech commented Sep 16, 2023

I've never used vite, but I'm all for learning new things. Are you talking about replacing our docs with vite?

@baseplate-admin
Copy link
Author

baseplate-admin commented Sep 16, 2023

I've never used vite, but I'm all for learning new things

That's something i rarely see. Most of the people are impervious to change.

Are you talking about replacing our docs with vite?

I was talking about replacing rollup with vite


If you want i can try to send a PR, replacing rollup with vite

@UziTech
Copy link
Member

UziTech commented Sep 16, 2023

Sure, it looks like vite uses rollup anyways so I don't see the point in adding a new layer. But if you create a PR we can see what the benefits are.

@UziTech
Copy link
Member

UziTech commented Sep 16, 2023

If it can reduces the size of the npm package I think it would be worth it. The gzip size grew dramatically after switching to typescript. Mainly because we now have to include source maps for each file.

@bent10
Copy link
Contributor

bent10 commented Oct 5, 2023

@UziTech If you're interested in migrating to Vite, I've reproduced the source code for Marked (without making any edits), and it works like a charm! Feel free to check out this repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants