marked
marked copied to clipboard
Move from `terser` to `esbuild`
What pain point are you perceiving?.
it seems that marked
is using terser for bundling
https://github.com/markedjs/marked/blob/de85e706e6dd3b3c4b2f836abc7ad8f206640045/rollup.config.js#L2
https://github.com/markedjs/marked/blob/de85e706e6dd3b3c4b2f836abc7ad8f206640045/rollup.config.js#L44
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
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.
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?
I've never used vite, but I'm all for learning new things. Are you talking about replacing our docs with vite?
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
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.
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.
@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.