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

fix: Import entrypoint improvements #1207

Merged
merged 10 commits into from
Dec 8, 2024
Merged

Conversation

aklinker1
Copy link
Collaborator

@aklinker1 aklinker1 commented Nov 25, 2024

This PR refactors the logic around how options are imported from JS entrypoints. Each entrypoint is still read and imported in parallel, but now only one instance of the vite-node dev server is ever setup (instead of one for every JS/TS entrypoint). This closes #1204.

Additionally, while doing the above refactor, I've reduced the footprint of the polyfilled extension environment while entrypoints are imported. Instead of creating multiple environments and polyfilling them in parallel, causing race conditions, the environment is polyfilled only once and is only present while importing the entrypoints. Before, the extension environment was also polyfilled when resolving vite config, the source of #931 (comment). This PR closes #931, and replaces #1231.

Copy link

netlify bot commented Nov 25, 2024

Deploy Preview for creative-fairy-df92c4 ready!

Name Link
🔨 Latest commit 129cf5e
🔍 Latest deploy log https://app.netlify.com/sites/creative-fairy-df92c4/deploys/6755d98dca35e10008e23d0e
😎 Deploy Preview https://deploy-preview-1207--creative-fairy-df92c4.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Timeraa
Copy link
Contributor

Timeraa commented Nov 28, 2024

Wouldn't this also massively speed up build times?

@aklinker1
Copy link
Collaborator Author

Wouldn't this also massively speed up build times?

It would speed up importing the entrypoints to get their options... I don't know by how much it will effect the overall build. In general, this step is quite short compared to the actual build, so I doubt it will have a huge effect.

@aklinker1 aklinker1 changed the title fix: Use a single Vite server when importing entrypoints during build to reduce number of event listeners fix: Use a single vite-node instance when importing entrypoints Dec 7, 2024
Copy link

pkg-pr-new bot commented Dec 8, 2024

Open in Stackblitz

@wxt-dev/auto-icons

npm i https://pkg.pr.new/@wxt-dev/auto-icons@1207

@wxt-dev/i18n

npm i https://pkg.pr.new/@wxt-dev/i18n@1207

@wxt-dev/module-react

npm i https://pkg.pr.new/@wxt-dev/module-react@1207

@wxt-dev/module-solid

npm i https://pkg.pr.new/@wxt-dev/module-solid@1207

@wxt-dev/module-svelte

npm i https://pkg.pr.new/@wxt-dev/module-svelte@1207

@wxt-dev/module-vue

npm i https://pkg.pr.new/@wxt-dev/module-vue@1207

@wxt-dev/storage

npm i https://pkg.pr.new/@wxt-dev/storage@1207

@wxt-dev/unocss

npm i https://pkg.pr.new/@wxt-dev/unocss@1207

wxt

npm i https://pkg.pr.new/wxt@1207

commit: 129cf5e

@aklinker1 aklinker1 marked this pull request as ready for review December 8, 2024 17:39
Copy link

codecov bot commented Dec 8, 2024

Codecov Report

Attention: Patch coverage is 92.18750% with 20 lines in your changes missing coverage. Please review.

Project coverage is 81.03%. Comparing base (1dc7c34) to head (129cf5e).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/wxt/src/core/builders/vite/index.ts 76.62% 18 Missing ⚠️
...es/wxt/src/core/utils/building/find-entrypoints.ts 98.80% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1207      +/-   ##
==========================================
- Coverage   81.29%   81.03%   -0.26%     
==========================================
  Files         128      128              
  Lines        6245     6286      +41     
  Branches     1066     1066              
==========================================
+ Hits         5077     5094      +17     
- Misses       1153     1177      +24     
  Partials       15       15              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@aklinker1 aklinker1 changed the title fix: Use a single vite-node instance when importing entrypoints fix: Import entrypoint improvements Dec 8, 2024
@aklinker1 aklinker1 self-assigned this Dec 8, 2024
@aklinker1 aklinker1 added the bug Something isn't working label Dec 8, 2024
@aklinker1 aklinker1 merged commit f7f03e2 into main Dec 8, 2024
18 checks passed
@aklinker1 aklinker1 deleted the fix-max-listeners-warning branch December 8, 2024 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants