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

Upgrade to Vite 6 #310

Merged
merged 1 commit into from
Dec 2, 2024
Merged

Upgrade to Vite 6 #310

merged 1 commit into from
Dec 2, 2024

Conversation

timacdonald
Copy link
Member

@timacdonald timacdonald commented Nov 26, 2024

Upgrades supported Vite version to the recently released Vite 6.

Read more: https://vite.dev/blog/announcing-vite6

Breeze testing

  • Blade with Alpine
  • Livewire (Volt Class API) with Alpine
  • Livewire (Volt Functional API) with Alpine
  • React with Inertia
  • Vue with Inertia

Jetstream testing

  • Vue
  • Livewire

Related PRs

Comment on lines -52 to -56
"vite": "^5.0.0",
"vite": "^6.0.0",
"vitest": "^0.34.4"
},
"peerDependencies": {
"vite": "^5.0.0"
Copy link
Member Author

@timacdonald timacdonald Nov 26, 2024

Choose a reason for hiding this comment

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

Bumped this straight to v6 instead of support both v5 and v6.

The Vite plugin is extremely stable and is feature complete.

I don't think we need to support both versions. You can stay on the current version until you are ready to update to Vite 6.

This will help keep our maintenance cost to a minimum.

Choose a reason for hiding this comment

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

Wouldn’t that make it to version 2?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not according to semver.

See: https://semver.org/#what-should-i-do-if-i-update-my-own-dependencies-without-changing-the-public-api

You will need to upgrade to Vite 6 in your own project.

Copy link

@meduzen meduzen Nov 29, 2024

Choose a reason for hiding this comment

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

Since the laravel-vite-plugin is not a standalone and requires vite to work, I’d consider the drop of Vite 5 to be a breaking change.

It becomes quickly complicated for users if they have to wonder if any minor/patch update will stop to work with their current setup. I would prefer a breaking, it sends a clearer signal.

What do you think?

Choose a reason for hiding this comment

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

just ran npm update (after v1.1.0 was released) and got this...

npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: undefined@undefined
npm error Found: vite@5.4.11
npm error node_modules/vite
npm error   dev vite@"^5.4.10" from the root project
npm error
npm error Could not resolve dependency:
npm error peer vite@"^6.0.0" from laravel-vite-plugin@1.1.0
npm error node_modules/laravel-vite-plugin
npm error   dev laravel-vite-plugin@"^1.0.5" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.

Copy link

Choose a reason for hiding this comment

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

I also get the same message

Copy link

@elvisblanco1993 elvisblanco1993 Dec 2, 2024

Choose a reason for hiding this comment

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

Make sure to change the vite version to "vite": "^6.0" in your package.json file. Then you should be able to update.

image

@kunalbedi
Copy link

When is this PR getting merged. Asking politely! ..
Dependabot going crazy sending me emails. 🥺 😄

@thorst
Copy link

thorst commented Nov 30, 2024

When I run npm run dev i get this warning Deprecation Warning: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0. are others getting that? I think this PR may fix my issues?

@Manoz
Copy link

Manoz commented Dec 2, 2024

When I run npm run dev i get this warning Deprecation Warning: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0. are others getting that? I think this PR may fix my issues?

This probably has to do with the fact that you have a SASS dependency somewhere on your project.

It should have nothing to do with Vite.js or laravel-vite-plugin.

@Moraiene
Copy link

Moraiene commented Dec 2, 2024

When I run npm run dev i get this warning Deprecation Warning: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0. are others getting that? I think this PR may fix my issues?

This probably has to do with the fact that you have a SASS dependency somewhere on your project.

It should have nothing to do with Vite.js or laravel-vite-plugin.

This is directly related to the vitе, because by default sass compilation is used "legacy", for fix this warning need to set option in config to "modern-compiler" in vite 6 default compilation - "modern-compiler"

@Moraiene
Copy link

Moraiene commented Dec 2, 2024

When I run npm run dev i get this warning Deprecation Warning: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0. are others getting that? I think this PR may fix my issues?

add to config this

    css: {
        preprocessorOptions: {
            scss: {
                api: 'modern-compiler',
            },
        },
    },

@thorst
Copy link

thorst commented Dec 2, 2024

Yes @Moraiene you are correct. Once I put that in, it fixed it. I was close. I had the css>preprocessorOptions>scss block and had traced it to this plugin (because it requires vite 5) but I got stuck there.

Once I put in your api parameter, the warning goes away. There were A LOT of import that I had to change to use, and then some pathing issues (like map.has-key instead of map-has-key). Glad those upgrades are out of the way.

Thanks again!!!

@taylorotwell taylorotwell merged commit 492c068 into 1.x Dec 2, 2024
6 checks passed
@taylorotwell taylorotwell deleted the vite-6 branch December 2, 2024 15:51
@Pixel-Navigators
Copy link

I am getting this error when I run laravel new example-app as well because of the version change


image

@thorst
Copy link

thorst commented Dec 2, 2024

@Pixel-Navigators Same, but if you change vite to 6 in your package.json itll work:

{
    "private": true,
    "type": "module",
    "scripts": {
        "dev": "vite",
        "build": "vite build"
    },
    "devDependencies": {
        "laravel-vite-plugin": "^1.0.6",
        "sass": "^1.81.0",
        "vite": "^6"
    },
    "dependencies": {
        "sass-loader": "^12.6.0"
    }
}

@thorst
Copy link

thorst commented Dec 2, 2024

Thanks for the merge @taylorotwell now I dont need the fix by @Moraiene, and I dont get build warnings anymore...yay!

@fruske
Copy link

fruske commented Dec 2, 2024

I am getting this error when I run laravel new example-app as well because of the version change

@Pixel-Navigators I found out the same. I opened a bug @ https://github.com/laravel/installer

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.