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

Converts webpack to rspack #45

Merged
merged 13 commits into from
Aug 14, 2024
Merged

Converts webpack to rspack #45

merged 13 commits into from
Aug 14, 2024

Conversation

elliotBraem
Copy link
Contributor

@elliotBraem elliotBraem commented Jul 30, 2024

rspack is a rust optimized, drop-in replacement of webpack.

  • replaces webpack with rspack
  • removes babel and replaces webpack packages with rspack compatible versions
  • replace raw-loader with asset/source
  • moves some dependencies to devDependencies (playwright, socket.io, prettier)
  • moves import map script tags into body tag (rather than after body tag)
  • removes webpack bundle analyzer and adds command -- this comes baked-in rspack
  • benchmark current dev + prod build times
  • benchmark rspack dev + prod build times
  • benchmark current bundle size
  • benchmark rspack bundle size
  • investigate large, unnecessary packages
    • highlight.js/lib and refactor both come from react-syntax-highlighter (used in near-social-vm), and amount to 400+ KB (solved with NearBuilders/VM#feat/syntax-highlighter)
    • @ethersproject, @web3-onboard, @viem/_esm, @web3-onboard, @ledgerhq/connect-kit, @WalletConnect - worth replacing web3-onboard with wagmi?
    • why is near-wallet-selector so large? 60KB
near-bos-webcomponent Webpack Rspack
dev build time 20.01s 8.28 s
prod build time 48.74s 10.54 s
bundle size (stat) 15.08 MB 12.38 MB
bundle size (parsed) 8.36 MB 6.70 MB
bundle size (gzipped) 2.74 MB 2.01 MB

@petersalomonsen
Copy link
Collaborator

Looks great @elliotBraem . I did not know about rspack. Are you able to make the test pass too?

@elliotBraem
Copy link
Contributor Author

@race-of-sloths include

@race-of-sloths
Copy link

race-of-sloths commented Aug 13, 2024

@elliotBraem Thank you for your contribution! Your pull request is now a part of the Race of Sloths!
Do you want to apply for monthly streak? Get 8+ score for a single PR this month and receive boost for race-of-sloths!

Shows profile picture for the author of the PR

Current status: executed
Reviewer Score
@race-of-sloths 1

Your contribution is much appreciated with a final score of 1!
You have received 20 (10 base + 10 monthly bonus) Sloth points for this contribution

Congratulations @elliotBraem! Your PR was highly scored and you completed another monthly streak! To keep your monthly streak make another pull request next month and get 8+ score for it

What is the Race of Sloths

Race of Sloths is a friendly competition where you can participate in challenges and compete with other open-source contributors within your normal workflow

For contributors:

  • Tag @race-of-sloths inside your pull requests
  • Wait for the maintainer to review and score your pull request
  • Check out your position in the Leaderboard
  • Keep weekly and monthly streaks to reach higher positions
  • Boast your contributions with a dynamic picture of your Profile

For maintainers:

  • Score pull requests that participate in the Race of Sloths
  • Engage contributors with fair scoring and fast responses so they keep their streaks
  • Promote the Race to the point where the Race starts promoting you
  • Grow the community of your contributors

Feel free to check our website for additional details!

Bot commands
  • For contributors
    • Include a PR: @race-of-sloths include to enter the Race with your PR
  • For maintainers:
    • Invite contributor @race-of-sloths invite to invite the contributor to participate in a race or include it, if it's already a runner.
    • Assign points: @race-of-sloths score [1/2/3/5/8/13] to award points based on your assessment.
    • Reject this PR: @race-of-sloths exclude to send this PR back to the drawing board.
    • Exclude repo: @race-of-sloths pause to stop bot activity in this repo until @race-of-sloths unpause command is called

@elliotBraem
Copy link
Contributor Author

elliotBraem commented Aug 13, 2024

@petersalomonsen, yeah! Rspack is a pretty cool project; it's a bit newer but seems to be gaining more traction because it's a drop-in replacement; it barely needed any additional config besides using the rspack versions of the plugins.

Thanks for pointing out the tests -- it looks like tests were failing to start because of a bad lockfile and then it turns out zavodil.near/widget/Lido uses an expired subgraph url, so the widget no longer works. I swapped it out for meta-pool-official.near/widget/MetaPoolStakeEth.

They're working now and this is ready to merge then.

@elliotBraem
Copy link
Contributor Author

I created separate tickets #47 and #48 just for future reference, if it's ever worthwhile to improve on.

@elliotBraem elliotBraem merged commit b70b23c into main Aug 14, 2024
1 check passed
@elliotBraem elliotBraem deleted the feat/rspack branch August 14, 2024 21:11
@race-of-sloths
Copy link

🥁 Score it!

@elliotBraem, please ask your peers to score the PR using @race-of-sloths score [1/2/3/5/8/13].
If no scoring is provided within 24 hours, this PR will be scored as 1 🦥

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

Successfully merging this pull request may close these issues.

3 participants