intlify / intlify/bundle-tools

<i18n> Block in Nuxt component leads to vite 500 error

Open
#424 1 comment 0 reactions 0 assignees View on GitHub
status: review needed
Dominant language
TypeScript
Stars
270
Forks
46
PR merge metrics
No merged PRs in 30d

Description

### Reporting a bug?

When adding a Block to a component in Nuxt the following error is thrown:

```
[vite-node]
[plugin:unplugin-vue-i18n:resource]
[VITE_ERROR]
/components/TestComp.vue?vue&type=i18n&index=0&locale=de-DE&lang.json

export default function (Component) { const _Component = Component _Component.__i18n = _Component.__i18n || [] _Component.__i18n.push({ "locale": "de-DE", "resource": { "breadcrumb.home": (()=>{const fn=(ctx) => {const { normalize: _normalize } = ctx;return _normalize(["Startseite"])};fn.source="Startseite";return fn;})() } }) } 


```

### Expected behavior

The component is compiled and the translation will be shown.

### Reproduction

https://stackblitz.com/edit/bobbiegoede-nuxt-i18n-starter-hrvq7nhs

### Issue Package

unplugin-vue-i18n

### System Info

```shell
System:
OS: Linux 5.0 undefined
CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 18.20.3 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 10.2.3 - /usr/local/bin/npm
pnpm: 8.15.6 - /usr/local/bin/pnpm
```

### Screenshot

_No response_

### Additional context

_No response_

### Validations

- [X] Read the [Contributing Guidelines](https://github.com/intlify/bundle-tools/blob/main/.github/contributing.md).
- [X] Read the README
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/intlify/bundle-tools/discussions).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.