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
Warnings when using Vite 5 / Rollup 4 #1033
Comments
Interesting. I was under the impression from antfu’s PR against rollup that it was supported in JSDoc/TSDoc style: We certainly want to mark these as side effect free if possible for better tree shaking. I’m happy for any further research/assistance in this area! |
@justin-schroeder maybe it needs a line after It also has this comment rollup/rollup#5024 (comment) |
I tried to investigate why these warnings occurred and found the doc says: Such an annotation is considered valid if it directly precedes a function declaration or a constant variable declaration where the first declared variable is a function and is only separated from the declaration by white-space or comments. I guess the reason is that even though Code: Shell output: So, updating all sections with a pure function wrapper ( RefIn rollup source code, https://github.com/rollup/rollup/blob/0b619fd737c71822878c91657f471305ebb19e73/src/utils/convert-ast.ts#L1234, you can see |
Wow, great research @g1eny0ung 👍 It’s a bit annoying to need to include a dummy function call in there, but based on your looking into it that seems like the best approach at the moment, so yes — I would accept a PR for that ❤️ |
Ok, I will try to do it. |
@justin-schroeder I've been thinking about this some more, and it seems like I'm complicating the issue because I saw the export const box = createSection(/* ... */)
// If we don't call `box()` anymore, the above declaration will be cut to:
createSection(/* ... */)
// Due to the `createSection` being a pure function, this declaration will be fully cut. Finally, I just remove all PR: #1069 |
Confirmed that @g1eny0ung’s fix on the |
Reproduction
None
Describe the bug
Using vite 5, rollup 4 is complaining about some invalid
@__NO_SIDE_EFFECTS__
commentsThey all seem to be when assigning a returned function to a const
e.g.
According to https://github.com/javascript-compiler-hints/compiler-notations-spec/blob/main/no-side-effects-notation-spec.md#2-const-variable-declaration maybe that's not supported? Happy to add a PR to remove them if that's the case, or maybe there's a better solution?
It is only a warning, and it does continue compiling.
Environment
• OS: N/A
• Browser: N/A
• Version: @formkit/inputs 1.3.0
The text was updated successfully, but these errors were encountered: