Skip to content

Problems with tsx template #402

@cernymatej

Description

@cernymatej

Reporting a bug?

After upgrading @nuxtjs/i18n from 8.5.3 to v9, I encountered several pre-transform errors. In my main project, it was the following error message: Pre-transform error: '>' expected. I tracked this down to an issue with parsing TSX templates.

While stripping down the project to identify the root cause, I also encountered the following errors:

ERROR  Internal server error: ',' expected.
   10:26:17 AM
  Plugin: unplugin-vue-i18n:directive

and

Pre-transform error: Type expected.

The last one is present in the minimal reproduction linked below.

This issue wasn’t present in @nuxtjs/[email protected].

This seems to work fine:

<script lang="ts">
export default defineComponent((props, ctx) => {
  return () => h('div', ['Test'])
})
</script>

I hope this reproduction is usable, even though it doesn’t directly use unplugin-vue-i18n, as it’s minimal enough to demonstrate the issue and doesn't use any @nuxtjs/i18n features.

Expected behavior

Tsx templates to work.

Reproduction

https://stackblitz.com/edit/github-ffpcjt-qcfsie?file=components%2FTestComponent.vue

Working:
https://stackblitz.com/edit/github-ffpcjt?file=nuxt.config.ts,components%2FTestComponent.vue,app.vue

Issue Package

unplugin-vue-i18n

System Info

System:
    OS: macOS 15.1
    CPU: (12) arm64 Apple M2 Max
    Memory: 5.24 GB / 96.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.9.0 - ~/.nvm/versions/node/v20.9.0/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 10.1.0 - ~/.nvm/versions/node/v20.9.0/bin/npm
    pnpm: 9.9.0 - ~/Library/pnpm/pnpm
    bun: 1.0.25 - ~/.bun/bin/bun
  Browsers:
    Chrome: 130.0.6723.116
    Safari: 18.1

Screenshot

No response

Additional context

No response

Validations

  • Read the Contributing Guidelines.
  • Read the README
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A open a GitHub Discussion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions