Reporting a bug?
Using the code from the following example from the website:
https://vue-i18n.intlify.dev/guide/advanced/function#named-interpolation
In a SFC like this
<i18n lang="js">
{
en: {
greeting: ({ named }) => `hello, ${named('name')}!`
}
}
</i18n>
Will cause the Vite build to fail with the following message:
[unplugin-vue-i18n:resource] Unexpected flow-map-start at node end
Expected behavior
I would expect this to build exactly like ti would when using a .js file that I load into createI18n()
For now I've been able to replace the code with a "hello, {name}!" which does the trick for the simpler interpolations, but it'd be nice if JS support was added to the SFC i18n objects.
PS: Thank you so much for making vue-i18n and the unplugin. It's such a blessing.
Reproduction
Adding a closure to any <i18n> will cause it.
<i18n lang="js">
{
en: {
greeting: ({ named }) => `hello, ${named('name')}!`
}
}
</i18n>
Issue Package
unplugin-vue-i18n
System Info
System:
OS: Linux 6.18 Fedora Linux 43 (Workstation Edition)
CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
Memory: 11.67 GB / 30.87 GB
Container: Yes
Shell: 5.9 - /usr/bin/zsh
Binaries:
Node: 22.22.0 - /usr/bin/node
npm: 10.9.0 - /usr/local/bin/npm
pnpm: 10.27.0 - /usr/bin/pnpm
Browsers:
Firefox: 148.0
Firefox Developer Edition: 148.0
npmPackages:
vite: ^7.0.3 => 7.0.3
vue: ^3.2.45 => 3.5.17
vue-i18n: ^11.1.2 => 11.1.9
Screenshot
No response
Additional context
I couldn't find any mention on how to work around the issue in the docs, or the discussions. It works when creating a message file / object and passing it directly into createI18n, so it seems like the <i18n> block simply gets parsed differently.
Validations
Reporting a bug?
Using the code from the following example from the website:
https://vue-i18n.intlify.dev/guide/advanced/function#named-interpolation
In a SFC like this
Will cause the Vite build to fail with the following message:
[unplugin-vue-i18n:resource] Unexpected flow-map-start at node endExpected behavior
I would expect this to build exactly like ti would when using a
.jsfile that I load intocreateI18n()For now I've been able to replace the code with a "hello, {name}!" which does the trick for the simpler interpolations, but it'd be nice if JS support was added to the SFC i18n objects.
PS: Thank you so much for making vue-i18n and the unplugin. It's such a blessing.
Reproduction
Adding a closure to any
<i18n>will cause it.Issue Package
unplugin-vue-i18n
System Info
System: OS: Linux 6.18 Fedora Linux 43 (Workstation Edition) CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz Memory: 11.67 GB / 30.87 GB Container: Yes Shell: 5.9 - /usr/bin/zsh Binaries: Node: 22.22.0 - /usr/bin/node npm: 10.9.0 - /usr/local/bin/npm pnpm: 10.27.0 - /usr/bin/pnpm Browsers: Firefox: 148.0 Firefox Developer Edition: 148.0 npmPackages: vite: ^7.0.3 => 7.0.3 vue: ^3.2.45 => 3.5.17 vue-i18n: ^11.1.2 => 11.1.9Screenshot
No response
Additional context
I couldn't find any mention on how to work around the issue in the docs, or the discussions. It works when creating a message file / object and passing it directly into
createI18n, so it seems like the<i18n>block simply gets parsed differently.Validations