Skip to content

wrong I18n locale when using dynamic import #420

@nickydinh88

Description

@nickydinh88

Describe the bug

The locale is wrong if I use dynamic import (e.g., in router).

const WizardPage = () => import( /* webpackChunkName: 'page-apply' */ "@/views/WizardPage/WizardPage.vue" );

Then, all the routes have the same locale.

"vite-ssg": "0.23.8",
"vue": "3.5.8",
"vue-i18n": "9.13.1",

Reproduction

Running vite-ssg build

System Info

System:
    OS: macOS 12.5.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 65.67 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 20.11.1 - ~/.nvm/versions/node/v20.11.1/bin/node
    Yarn: 1.22.22 - /usr/local/bin/yarn
    npm: 10.2.4 - ~/.nvm/versions/node/v20.11.1/bin/npm
  Browsers:
    Chrome: 129.0.6668.90
    Safari: 15.6.1

Used Package Manager

yarn

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • 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, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Contributions

  • I am willing to submit a PR to fix this issue
  • I am willing to submit a PR with failing tests (actually just go ahead and do it, thanks!)

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