Skip to content

Fix Vite 6 compatibility: Check for 'this' before accessing this.meta#587

Merged
ElMassimo merged 1 commit intoElMassimo:mainfrom
inngineer:fix/vite-6-compatibility
Feb 16, 2026
Merged

Fix Vite 6 compatibility: Check for 'this' before accessing this.meta#587
ElMassimo merged 1 commit intoElMassimo:mainfrom
inngineer:fix/vite-6-compatibility

Conversation

@inngineer
Copy link
Contributor

@inngineer inngineer commented Jan 26, 2026

Vite 6 changed how it invokes plugin hooks - the config hook no longer receives the plugin context (this). This causes 'TypeError: undefined is not an object (evaluating this.meta)' when using Vite 6.

This fix adds a null check for 'this' before accessing this.meta to maintain compatibility with both Vite 5 and Vite 6.

Fixes: TypeError when starting Vite 6 dev server
Tested with: Vite 6.4.1, vite_ruby 3.9.2, Rails 8.0.4

Vite 6 changed how it invokes plugin hooks - the config hook no longer
receives the plugin context (this). This causes 'TypeError: undefined is
not an object (evaluating this.meta)' when using Vite 6.

This fix adds a null check for 'this' before accessing this.meta to
maintain compatibility with both Vite 5 and Vite 6.

Fixes: TypeError when starting Vite 6 dev server
Tested with: Vite 6.4.1, vite_ruby 3.9.2, Rails 8.0.4
@ElMassimo ElMassimo merged commit f73186f into ElMassimo:main Feb 16, 2026
6 of 17 checks passed
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.

2 participants