bundle-tools icon indicating copy to clipboard operation
bundle-tools copied to clipboard

Problems with parsing TSX

Open cernymatej opened this issue 1 year ago • 2 comments

Reporting a bug?

As reported in https://github.com/intlify/bundle-tools/issues/402, there are some problems with parsing the TSX template and I believe they were not fixed by https://github.com/intlify/bundle-tools/pull/414.

Specifically, the following error appears in the console when trying to run the dev server: Pre-transform error: '>' expected.

IMPORTANT: this doesn't show up in the reproduction on Stackblitz, because it is masked by https://github.com/intlify/bundle-tools/issues/420, however, when you download it and run it locally, you can see the error. (at least on my machine - check system info)

Expected behavior

No error should appear and the app should build successfully

Reproduction

https://stackblitz.com/edit/github-ffpcjt-wvpad2?file=package.json

Issue Package

vite-plugin-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

image

Additional context

No response

Validations

  • [X] Read the Contributing Guidelines.
  • [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.

cernymatej avatar Dec 06 '24 20:12 cernymatej

Thank you for your reporting!

Unfortunately, This issue caused by v-t directive optimization. Nuxt i18n optimize with using vue-i18n-extensions, which has still issue for tsx. 😞

v-t is supported by vue-i18n, but this directive is scheduled to be deprecated in vue-i18n v12. In anticipation of this, nuxt i18n has added an option that allows you to opt out in v9.1.1. You can avoid this by setting the following in nuxt.config.ts.

i18n: {
  bundle: {
    optimizeTranslationDirective: false
  }
}

kazupon avatar Dec 08 '24 08:12 kazupon

Thank you! ❤️ I can finally update to nuxt-i18n v9 🥳

So, it is probably not worth fixing it if it's going to be removed, correct? I'll add information about this into the issue in nuxt-i18n as well.)

Feel free to close this.

cernymatej avatar Dec 08 '24 16:12 cernymatej