Skip to content

fix: Import entrypoint improvements - #1207

Merged
aklinker1 merged 10 commits into
mainfrom
fix-max-listeners-warning
Dec 8, 2024
Merged

aklinker1 merged 10 commits into
mainfrom
fix-max-listeners-warning

Conversation

@aklinker1

@aklinker1 aklinker1 commented Nov 25, 2024 •

Copy link
Copy Markdown
Member

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.

@netlify

netlify Bot commented Nov 25, 2024 •

Copy link
Copy Markdown

✅ 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

Timeraa commented Nov 28, 2024

Copy link
Copy Markdown
Member

Wouldn't this also massively speed up build times?

@aklinker1

Copy link
Copy Markdown
Member 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
@pkg-pr-new

pkg-pr-new Bot commented Dec 8, 2024 •

Copy link
Copy Markdown

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
@codecov

codecov Bot commented Dec 8, 2024 •

Copy link
Copy Markdown

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 label Dec 8, 2024
@aklinker1
aklinker1 merged commit f7f03e2 into main Dec 8, 2024
@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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MaxListenersExceededWarning when having 11+ content scripts defined vite-plugin-node-polyfills breaks the compilation

2 participants