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

Why use prettier? #23

Open
barm opened this issue Apr 1, 2021 · 7 comments
Open

Why use prettier? #23

barm opened this issue Apr 1, 2021 · 7 comments
Labels
help wanted Extra attention is needed

Comments

@barm
Copy link

barm commented Apr 1, 2021

Hey Matt, love the idea here. I'm considering this for use and one question I had is: why run the async script / source script through prettier? Doesn't seem worth the tradeoff to me of needing a top-level dependency for prettier for code that will really only be read by the browser. Probably is some slight perf penalty too but haven't profiled it to know if it's meanginful. Thanks for in advance for entertaining my question!

@mattlewis92
Copy link
Owner

Hey! It was mainly just done as a quick fix to make sure the output was readable and formatted correctly, I think it could be swapped out for something simpler like https://github.com/dmnd/dedent or maybe there's even a webpack helper function to do it? Would happily accept a PR to improve this!

@mattlewis92 mattlewis92 added the help wanted Extra attention is needed label Apr 1, 2021
@barm
Copy link
Author

barm commented Apr 1, 2021

Cool, I'll take a look and come back with a proposal!

@thomaswelton
Copy link

Probably is some slight perf penalty too

Prettier makes up 99.4% of this packages overall size
https://bundlephobia.com/package/webpack-retry-chunk-load-plugin@2.2.0

@hirbod
Copy link

hirbod commented Sep 21, 2021

@thomaswelton will this also bloat the production code or only in development? Not sure how much overhead this plugin would add right now - I don't want to ship prettier to the final product

@mattlewis92
Copy link
Owner

@thomaswelton will this also bloat the production code or only in development? Not sure how much overhead this plugin would add right now - I don't want to ship prettier to the final product

The plugin doesn't bundle prettier inside your apps code, it's just installed in your node_modules, the only benefit to swapping it out is to the developer for a slightly faster npm install time of the package, as well as taking up less space on the disk.

@hirbod
Copy link

hirbod commented Sep 21, 2021

@mattlewis92 thanks for clarification. So a no brainer, since prettier is installed anyway in my project :)

@joeycozza
Copy link

@thomaswelton will this also bloat the production code or only in development? Not sure how much overhead this plugin would add right now - I don't want to ship prettier to the final product

The plugin doesn't bundle prettier inside your apps code, it's just installed in your node_modules, the only benefit to swapping it out is to the developer for a slightly faster npm install time of the package, as well as taking up less space on the disk.

Heroku has a slug size limit, and the slug includes node_modules. So relying on prettier does potentially impact more than just slightly faster npm install time and local disk space. Some of the teams I work with are bumping into the slug size limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants