Skip to content

feat: add vitePluginsBefore option#2170

Merged
aklinker1 merged 4 commits intowxt-dev:mainfrom
mrtnbroder:main
Mar 4, 2026
Merged

feat: add vitePluginsBefore option#2170
aklinker1 merged 4 commits intowxt-dev:mainfrom
mrtnbroder:main

Conversation

@mrtnbroder
Copy link
Contributor

@mrtnbroder mrtnbroder commented Mar 2, 2026

this allows plugins like @tanstack/router-plugin to be added before the react plugin to work correctly

Overview

When using e.g. pnpm install together with wxt and @tanstack/router-plugin I got the following error:

 ERROR  Plugin order error: '@vitejs/plugin-react' is placed before '@tanstack/router-plugin'.
│ The TanStack Router plugin must come BEFORE JSX transformation plugins.
│ Please update your Vite config:
│   plugins: [
│     tanstackRouter(),
│     react(),
│   ]

To fix this issue, the easiest solution was to add a vitePluginsBefore field and add the plugin there.

Manual Testing

Add the plugin to vitePluginsBefore and see no error raised.

Related Issue

This PR closes #<issue_number>

@mrtnbroder mrtnbroder requested a review from aklinker1 as a code owner March 2, 2026 10:08
@netlify
Copy link

netlify bot commented Mar 2, 2026

Deploy Preview for creative-fairy-df92c4 ready!

Name Link
🔨 Latest commit ee3a1f8
🔍 Latest deploy log https://app.netlify.com/projects/creative-fairy-df92c4/deploys/69a86aca5c69450008d0a75f
😎 Deploy Preview https://deploy-preview-2170--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 project configuration.

@github-actions github-actions bot added the pkg/module-react Includes changes to the `packages/module-react` directory label Mar 2, 2026
this allows plugins like @tanstack/router-plugin to be added before the
react plugin to work correctly
@aklinker1 aklinker1 changed the title fix: add vitePluginsBefore feat: add vitePluginsBefore option Mar 3, 2026
@codecov
Copy link

codecov bot commented Mar 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.42%. Comparing base (301e4a1) to head (ee3a1f8).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2170      +/-   ##
==========================================
- Coverage   76.58%   76.42%   -0.17%     
==========================================
  Files         115      115              
  Lines        3079     3079              
  Branches      698      698              
==========================================
- Hits         2358     2353       -5     
- Misses        637      641       +4     
- Partials       84       85       +1     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@aklinker1 aklinker1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, one small change, make vite a peer dependency. The next major version of WXT will be doing the same.

This is also why the PR checks are failing - you're importing from a dev dependency, which means tsdown doesn't know if the import should be inlined or not. Moving Vite to peerDependencies resolves this because it informs tsdown that vite will be externalized.

@mrtnbroder mrtnbroder requested a review from aklinker1 March 4, 2026 10:11
@mrtnbroder mrtnbroder requested a review from aklinker1 March 4, 2026 17:24
@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 4, 2026

Open in StackBlitz

@wxt-dev/analytics

npm i https://pkg.pr.new/@wxt-dev/analytics@2170

@wxt-dev/auto-icons

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

@wxt-dev/browser

npm i https://pkg.pr.new/@wxt-dev/browser@2170

@wxt-dev/i18n

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

@wxt-dev/is-background

npm i https://pkg.pr.new/@wxt-dev/is-background@2170

@wxt-dev/module-react

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

@wxt-dev/module-solid

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

@wxt-dev/module-svelte

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

@wxt-dev/module-vue

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

@wxt-dev/runner

npm i https://pkg.pr.new/@wxt-dev/runner@2170

@wxt-dev/storage

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

@wxt-dev/unocss

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

@wxt-dev/webextension-polyfill

npm i https://pkg.pr.new/@wxt-dev/webextension-polyfill@2170

wxt

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

commit: 8a267a7

@aklinker1 aklinker1 merged commit a14d0b4 into wxt-dev:main Mar 4, 2026
15 checks passed
@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

Thanks for helping make WXT better!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg/module-react Includes changes to the `packages/module-react` directory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants