-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Support running Benchmark in Browser #14
Conversation
@mtkennerly could you help take a look? |
Hi! Thanks for your PR. I'm open to this, but I'd like to better understand the issues you encountered. The Karma example does run in the browser, although it's using Browserify - would your changes here mean that Browserify is no longer needed?
I would have expected the other items to be tree-shaken. Why is it necessary to move the items out of
Which Webpack issue does it solve? Is it related to kumavis/browser-process-hrtime#11 ? |
Thanks for your review! Haha I'd like to appreciate your work first, this is the only library which meets my need. It saves my life.
On production, it's supposed to work, I didn't try it. My problem is, for webpack, tree-shaking happens on the minification phase and is not available on dev mode. So, on dev mode, webpack imports all code including reporters and some nodejs-only dependencies. After moving the code, we can import it like
Yes. I just accepted the suggestion given in this thread to replace |
fe6f266
to
198094c
Compare
Thanks for the kind words :D I'm glad you've found it helpful. I'm fine with the dependency changes here. For the other issue, rather than move
That should result in a smaller diff and let you keep the nicer Let me know if you'd like to make those changes in this PR :) |
That's great! I'll refine my PR. Maybe I also need to change the Doc. |
Updated the code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This is great.
It looks like the dependency changes got reset, but I can add those back after merging :)
I'll publish a new release shortly.
I re-arrange code and split them into files so we can only import
Benchmark
in browser environment.Replaced
browser-process-hrtime
withbrowser-hrtime
which is newer and resolve a webpack issueReplaced
events
witheventEmitter3
which is faster and also support browserThough there is a bunch of code change, but I don't change any logic actually.