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

node_modules/.pnpm/[email protected][email protected]/node_modules/vue-i18n/dist/vue-i18n.runtime.mjs (303:20) A comment "/* #__PURE__*/" in "node_modules/.pnpm/[email protected][email protected]/node_modules/vue-i18n/dist/vue-i18n.runtime.mjs" contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues. #1599

Closed
4 tasks done
newives opened this issue Oct 21, 2023 · 5 comments
Labels
has the workaround ❗ p4-important Priority 4: bugs that violate documented behavior, or significantly impact perf Type: Improvement Includes backwards-compatible fixes

Comments

@newives
Copy link
Contributor

newives commented Oct 21, 2023

Reporting a bug?

Packaging error

pnpm build

Expected behavior

Packaging without error

Reproduction

https://stackblitz.com/edit/vitejs-vite-jq7jch?file=src%2Fmain.ts

System Info

vite 5
mac
google

Screenshot

图片

Additional context

No response

Validations

@sapphi-red
Copy link

Here's the places the warning is pointing at:

/* #__PURE__ */ indicates the next expression after it can be removed if the evaluated value of that expression is not used. So /* #__PURE__ */ should be placed immediately before the function call, not before the function declarations/expressions. Function declarations/expressions are pure in nature.

You can also just swap /* #__PURE__ */ with /* #__NO_SIDE_EFFECTS__ */ which works as you expect. But it's only supported by rollup and esbuild currently.

@Mohith-113
Copy link

This error is caused by a comment annotation in the vue-i18n runtime module that Rollup cannot interpret. The comment is supposed to mark a pure function, but it is placed in a wrong position. Rollup will remove the comment to avoid issues, but this may affect the tree-shaking and bundling process1.

To fix this error, you have a few options:

You can try to update your vite and vue-i18n versions to the latest ones, and see if the error is resolved. Some users have reported that this worked for them2.
You can use the @rollup/plugin-replace plugin to replace the comment annotation with an empty string in your rollup.config.js file. This will prevent Rollup from removing the comment and causing issues. You can find an example of how to do this in this GitHub issue.
You can use the @rollup/plugin-strip plugin to strip all comments from the vue-i18n runtime module in your rollup.config.js file. This will also prevent Rollup from removing the comment and causing issues. You can find an example of how to do this in this Stack Overflow answer.
I hope this information helps you fix the error and use vue-i18n with vite successfully. 😊

@kazupon kazupon added Type: Bug Bug or Bug fixes ❗ p4-important Priority 4: bugs that violate documented behavior, or significantly impact perf Type: Improvement Includes backwards-compatible fixes and removed Status: Review Needed Request for review comments Type: Bug Bug or Bug fixes labels Oct 22, 2023
@kazupon kazupon added has the workaround 🔨 p3-minor-bug Priority 3: a bug in an edge case that only affects very specific usage ❗ p4-important Priority 4: bugs that violate documented behavior, or significantly impact perf and removed ❗ p4-important Priority 4: bugs that violate documented behavior, or significantly impact perf labels Oct 23, 2023 — with Volta.net
@kazupon kazupon removed the 🔨 p3-minor-bug Priority 3: a bug in an edge case that only affects very specific usage label Oct 26, 2023
@newives
Copy link
Contributor Author

newives commented Nov 1, 2023

Hey, the stable version of vite5 will be released soon. Does the author have an official solution for this? Because this warning will be reported every time when packaging.

Copy link
Member

kazupon commented Nov 1, 2023

Hi!
I’m going to fix this issue.
Just a little busy until around mid Nov, so I have after work of conference, and I have meetup event as speaker.
I'll fix when those are done.

vue-i18n and intlify project is OSS
if you have a time, you can contribute :)

@newives
Copy link
Contributor Author

newives commented Nov 1, 2023

PTAL #1623
I conducted a local test and after modification, the warning no longer appears when packaging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has the workaround ❗ p4-important Priority 4: bugs that violate documented behavior, or significantly impact perf Type: Improvement Includes backwards-compatible fixes
Projects
None yet
Development

No branches or pull requests

4 participants