Skip to content

Adopt Vite+ - #4028

Merged
nstepien merged 47 commits into
mainfrom
viteplus
Oct 5, 2026
Merged

nstepien merged 47 commits into
mainfrom
viteplus

Conversation

@nstepien

@nstepien nstepien commented Apr 2, 2026

Copy link
Copy Markdown
Collaborator

@nstepien nstepien self-assigned this Apr 2, 2026
@codecov-commenter

codecov-commenter commented Oct 3, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.30%. Comparing base (b786d20) to head (9ed48e7).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4028   +/-   ##
=======================================
  Coverage   98.30%   98.30%           
=======================================
  Files          45       45           
  Lines        1943     1944    +1     
  Branches      732      733    +1     
=======================================
+ Hits         1910     1911    +1     
  Misses         33       33           

see 1 file with indirect coverage changes

🚀 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.

@nstepien
nstepien marked this pull request as ready for review October 4, 2026 23:40
@nstepien
nstepien requested a review from amanmahajan7 as a code owner October 4, 2026 23:40
@nstepien
nstepien merged commit 5c89257 into main Oct 5, 2026
5 checks passed
@nstepien
nstepien deleted the viteplus branch October 5, 2026 00:12

@amanmahajan7 amanmahajan7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is great. Anything noteworthy?

Comment thread .github/dependabot.yml
Comment on lines +15 to +16
- dependency-name: 'vitest'
- dependency-name: '@vitest/*'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we still install these packages separately?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

vite-plus manages these dependencies via vp migrate, as vite-plus expects specific package versions.
I hope they'll make it simpler in the future, or hope they'll release an updater action.

Comment thread .vscode/settings.json
Comment on lines +26 to +27
"oxc.disableNestedConfig": true,
"oxc.fmt.disableNestedConfig": true

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we need these?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It was added by vp migrate
vp does not support nested configs

Comment thread package.json
Comment on lines +85 to +86
"allowScripts": {
"core-js": false

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

what does this do?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Disables core-js's install script (a donation plea), otherwise npm logs this:

npm warn install-scripts 1 package had install scripts blocked because they are not covered by allowScripts:
npm warn install-scripts   core-js@3.50.0 (postinstall: node -e "try{require('./postinstall')}catch(e){}")
npm warn install-scripts
npm warn install-scripts Run `npm install-scripts ls` to review, or `npm install-scripts approve <pkg>` to allow.

https://github.blog/changelog/2026-06-09-upcoming-breaking-changes-for-npm-v12/

Comment thread vite.config.ts
Comment on lines +65 to +68
staged: {
'*': 'vp fmt --no-error-on-unmatched-pattern',
'*.md': 'vp run eslint'
},

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

how do you like the pre commit hooks?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Works great, essentially invisible since vp fmt is fast, and we rarely touch .md files.

Might have some conflicts if you have staged/unstaged blocks in the same file, but it stashes these unstaged changes while running the hooks.
Though it can lead to git conflicts, and fail to commit, but that's rare.

We could also use *': vp check --fixinstead ofvp fmt`, but that might be a bit too much?

I wonder if we should add more hooks.

Comment thread package.json
"lint:md": "eslint --max-warnings 0",
"lint:fix": "oxlint --fix && eslint --fix",
"typecheck": "tsc --build"
"prepare": "vp config"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

only one command needed? nice!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Well they're moved to tasks in vite.config.ts, so we can benefit from caching.
prepare runs after you run npm install/vp install.
I've added vp run ci (or vpr ci) so you can all the checks locally, just like in CI.

@nstepien

nstepien commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator Author

Anything noteworthy?

  • vp manages which node.js/npm version is used, so you don't have to worry about switching to an older branch or a different repository that expect different versions
    • this is controlled by devEngines in package.json in this repo
    • see vp env, vp env pin --help, vp env current, vp env doctor
    • vp will download the necessary node.js/npm version transparently when you use it
    • you'll need to configure your shell environment, vp should guide with that
  • vp should also work in repos that don't use vp
  • npm run */node --run * -> vp run * === vpr *
    • it handles both "tasks" in the vite config, and "scripts" in package.json
    • it handles arguments better, so npm run typecheck -- --watch -> vpr typecheck --watch, no need for the extra --
    • vp run args are passed before the task/script, like this: vp run --no-cache eslint/vpr --no-cache eslint, no confusion
    • tasks can have multiple commands
      • in that case, passing an arg is passed to the last command
      • so with the following, vpr mytask --arg will run a then b --arg.
        run: {
          tasks: {
            mytask: {
              command: ['a', 'b']
            },
          },
        },
      • tasks can have dependency tasks via dependsOn, which runs the dependencies in parallel
  • npx -> vpx
  • npm start -> vp dev
  • lazyPlugins avoids loading/initializing vite plugins in unrelated commands like vp fmt or vp check, but it does not work with pack's plugins, hope they fix it
  • I've merged the visual tests into the browser project to keep things simple
  • for actions

I'm sure there's even more stuff, but that's a good start 🙂

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