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

Browser hangs on large files #10

Open
tom-sherman opened this issue Sep 4, 2019 · 2 comments
Open

Browser hangs on large files #10

tom-sherman opened this issue Sep 4, 2019 · 2 comments

Comments

@tom-sherman
Copy link

Should probably utilise a Web Worker to perform the minification in a separate thread.

@tom-sherman
Copy link
Author

I've done some experimenting on my own minifier-in-a-browser (https://github.com/tom-sherman/yet-another-js-online-minifier)

Turns out that only some of the freeze up is caused by the minification, the rest is caused by just pasting large amounts of text into an input.

In my version, I solved the freezing issue completely by doing two things:

  1. Offload the minification to a worker. I used terser for minification but should work just as well with uglify.
  2. Use CodeMirror for the input

CodeMirror sidesteps the paste-jank by virtualising all of the code lines and only rendering to the DOM those that are on screen.

@Skalman
Copy link
Owner

Skalman commented Sep 27, 2019

Sorry for the late reply. This seems like a great idea. If you'd like to submit a pull request, I'd be happy to merge it.

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

No branches or pull requests

2 participants