vitejs / vite-plugin-vue

Vite Vue Plugins
MIT License
500 stars 154 forks source link

Breaking change introduced in 5.1.0 #431

Closed yassilah closed 3 months ago

yassilah commented 3 months ago

Related plugins

Describe the bug

This is simply to raise a concern regarding the breaking change introduced in 5.1.0 for setting custom features (e.g. propsDestructure). My Nuxt 3 application suddenly stopped working as I'm using propsDestructure by default and it took me a while to realize that it was due to the latest @vitejs/plugin-vue package update. I'm just raising the issue in case other packages/libraries/frameworks relying on it face the same issue.

Related: https://github.com/nuxt/nuxt/issues/28295

Reproduction

https://stackblitz.com/edit/github-g3udp4?file=nuxt.config.ts

Steps to reproduce

No response

System Info

-

Used Package Manager

pnpm

Logs

No response

Validations

sxzz commented 3 months ago

Since it's an experimental feature, it doesn't follow semver.

arpowers commented 3 months ago

I have a breaking change in 5.1.0 as well, builds are breaking with Expected ">" but found "lang"

It's really tough to debug as it was working locally, broken in CI. Rolling back the version to 5.0.5 fixed it.

Here is link to build https://github.com/fictionco/fiction/actions/runs/10084436525/job/27883222507

sxzz commented 3 months ago

Could you please provide a minimal reproduction or at least a detailed method to easily reproduce the build error on the local machine?

arpowers commented 3 months ago

@sxzz i would love to but I couldn't duplicate this outside of CI.

All I know is rolling back the dep fixed the problem.

Will try again in a couple days.

s3xysteak commented 3 months ago

@sxzz Another similar report found. https://github.com/dcloudio/uni-preset-vue/issues/102

sxzz commented 3 months ago

Should be fixed in v5.1.1

danielroe commented 3 months ago

I would add that although propsDestructure is experimental, I don't think the way to enable/disable it should break unexpectedly. At the very least until it is stabilised, I would suggest preserve backwards-compatibility for how to enable/disable this feature, which would be a one-line change.

sxzz commented 3 months ago

@danielroe Thanks for your advice. It's fixed!

danielroe commented 3 months ago

Thank you ❤️

scandar commented 3 months ago

I have a breaking change in 5.1.0 as well, builds are breaking with Expected ">" but found "lang"

I'm experiencing the same error on 5.1.0 - 5.1.2, it happens when building a production build in the server bundle.

sxzz commented 3 months ago

Could you create a new issue with a reproduction?

negezor commented 3 months ago

@sxzz updating @vitejs/plugin-vue from version 5.1.0 to 5.1.1 breaks the PWA build. I manually reverted the changes in node_modules from this commit f5eb5ac5c0517c6718b8b0caca965ad640161d7f, and everything works fine. I wasn't able to create a reproduction to demonstrate the issue. However, I can provide the error log from the build:

> vite build --ssrManifest --outDir dist/client

vite v5.4.1 building for production...
✓ 1170 modules transformed.
x Build failed in 7.20s
error during build:
[vite-plugin-pwa:build] Unexpected token, expected "," (1:8)
file: /home/negezor/projects/shiromu/web-service/src/components/EventCard.vue?vue&type=script&setup=true&lang.ts:1:8
    at constructor (/home/negezor/projects/shiromu/web-service/node_modules/@babel/parser/lib/index.js:349:19)
    at TypeScriptParserMixin.raise (/home/negezor/projects/shiromu/web-service/node_modules/@babel/parser/lib/index.js:3247:19)
    at TypeScriptParserMixin.unexpected (/home/negezor/projects/shiromu/web-service/node_modules/@babel/parser/lib/index.js:3267:16)
    at TypeScriptParserMixin.expect (/home/negezor/projects/shiromu/web-service/node_modules/@babel/parser/lib/index.js:3577:12)
    at TypeScriptParserMixin.tsParseDelimitedListWorker (/home/negezor/projects/shiromu/web-service/node_modules/@babel/parser/lib/index.js:7654:14)
    at TypeScriptParserMixin.tsParseDelimitedList (/home/negezor/projects/shiromu/web-service/node_modules/@babel/parser/lib/index.js:7631:25)
    at TypeScriptParserMixin.tsParseBracketedList (/home/negezor/projects/shiromu/web-service/node_modules/@babel/parser/lib/index.js:7671:25)
    at TypeScriptParserMixin.tsParseTypeParameters (/home/negezor/projects/shiromu/web-service/node_modules/@babel/parser/lib/index.js:7773:24)
    at /home/negezor/projects/shiromu/web-service/node_modules/@babel/parser/lib/index.js:9410:29
    at TypeScriptParserMixin.tryParse (/home/negezor/projects/shiromu/web-service/node_modules/@babel/parser/lib/index.js:3585:20)

For now, I have locked the version of @vitejs/plugin-vue to 5.1.0.

sxzz commented 3 months ago

@negezor Could you please raise a new issue & provide a minimal reproduction? Thanks.

Why reproduction is required