Skip to content
New issue

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

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

Already on GitHub? # to your account

lazy-require pretty-error to improve startup time #1788

Closed
Knagis opened this issue Apr 14, 2023 · 3 comments · Fixed by #1789
Closed

lazy-require pretty-error to improve startup time #1788

Knagis opened this issue Apr 14, 2023 · 3 comments · Fixed by #1789

Comments

@Knagis
Copy link
Contributor

Knagis commented Apr 14, 2023

Current behaviour 💣

require("pretty-error") is run at startup since it is required in module scope. However, somehow that is rather heavy package to load, can take 200ms.

Expected behaviour ☀️

Only do require("pretty-error") when actual error happens.

Reproduction Example 👾

Anything that includes html-webpack-plugin, start node with --inspect-brk, attach debugger and profile. Or put console.logs in errors.js

Environment 🖥

node 16, node 18
html-webpack-plugin 5.5.0
@alexander-akait
Copy link
Collaborator

@Knagis yeah, let's do it, do you want to send a PR?

@Knagis
Copy link
Contributor Author

Knagis commented Apr 14, 2023

ok, will do

@Knagis
Copy link
Contributor Author

Knagis commented Apr 14, 2023

PR ready.

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

Successfully merging a pull request may close this issue.

2 participants