Skip to content

ReferenceError: __VUE_PROD_DEVTOOLS__ is not defined when using vue-i18n in SSR / externalized node_modules #2253

@YKDZ

Description

@YKDZ

Reporting a bug?

If vue-i18n is externalized in a Vite SSR build, importing its distributed bundle at runtime causes the server to throw the following error:

PS C:\Users\YKDZ\Desktop\my-app> pnpm preview

> @ preview C:\Users\YKDZ\Desktop\my-app
> cross-env NODE_ENV=production node dist/server/index.js

Server running at http://localhost:3000
file:///C:/Users/YKDZ/Desktop/my-app/node_modules/.pnpm/vue-i18n@11.1.11_vue@3.5.21_typescript@5.9.2_/node_modules/vue-i18n/dist/vue-i18n.mjs:2064
            if (((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) && !false) {
                                                            ^

ReferenceError: __VUE_PROD_DEVTOOLS__ is not defined
    at Object.install (file:///C:/Users/YKDZ/Desktop/my-app/node_modules/.pnpm/vue-i18n@11.1.11_vue@3.5.21_typescript@5.9.2_/node_modules/vue-i18n/dist/vue-i18n.mjs:2064:61)
    at Object.use (C:\Users\YKDZ\Desktop\my-app\node_modules\.pnpm\@vue+runtime-core@3.5.21\node_modules\@vue\runtime-core\dist\runtime-core.cjs.prod.js:2995:18)
    at onCreateApp (file:///C:/Users/YKDZ/Desktop/my-app/dist/server/entries/pages_index.mjs:43:12)
    at file:///C:/Users/YKDZ/Desktop/my-app/node_modules/.pnpm/vike-vue@0.9.2_vike@0.4.238_fa18f387c1acb616273f321ab9e11cd4/node_modules/vike-vue/dist/getHeadSetting-CluLhiHU.js:18:14
    at Array.map (<anonymous>)
    at callCumulativeHooks (file:///C:/Users/YKDZ/Desktop/my-app/node_modules/.pnpm/vike-vue@0.9.2_vike@0.4.238_fa18f387c1acb616273f321ab9e11cd4/node_modules/vike-vue/dist/getHeadSetting-CluLhiHU.js:15:33)
    at createVueApp (file:///C:/Users/YKDZ/Desktop/my-app/node_modules/.pnpm/vike-vue@0.9.2_vike@0.4.238_fa18f387c1acb616273f321ab9e11cd4/node_modules/vike-vue/dist/getHeadSetting-CluLhiHU.js:74:9)
    at renderPageToHtml (file:///C:/Users/YKDZ/Desktop/my-app/node_modules/.pnpm/vike-vue@0.9.2_vike@0.4.238_fa18f387c1acb616273f321ab9e11cd4/node_modules/vike-vue/dist/integration/onRenderHtml.js:74:33)
    at Object.onRenderHtml [as hookFn] (file:///C:/Users/YKDZ/Desktop/my-app/node_modules/.pnpm/vike-vue@0.9.2_vike@0.4.238_fa18f387c1acb616273f321ab9e11cd4/node_modules/vike-vue/dist/integration/onRenderHtml.js:27:38)
    at file:///C:/Users/YKDZ/Desktop/my-app/node_modules/.pnpm/vike@0.4.238_vite@7.1.4_@types+node@20.19.11_tsx@4.20.5_/node_modules/vike/dist/esm/shared/hooks/execHook.js:37:65

Node.js v22.17.1
 ELIFECYCLE  Command failed with exit code 1.

This issue can be easily fixed by setting vue-i18n to noExternal.

Expected behavior

vue-i18n should work correctly when externalized.

Reproduction

https://github.com/YKDZ/vue-i18n-ssr-external-issue-reproduction

System Info

System:
    OS: Windows 11 10.0.26100
    CPU: (16) x64 Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz
    Memory: 6.64 GB / 31.83 GB
  Binaries:
    Node: 22.17.1 - ~\AppData\Local\fnm_multishells\42492_1756824206758\node.EXE
    npm: 10.9.2 - ~\AppData\Local\fnm_multishells\42492_1756824206758\npm.CMD
    pnpm: 10.15.0 - ~\AppData\Local\fnm_multishells\42492_1756824206758\pnpm.CMD
  Browsers:
    Edge: Chromium (139.0.3405.125)
    Internet Explorer: 11.0.26100.1882
  npmPackages:
    @vitejs/plugin-vue: ^6.0.1 => 6.0.1
    @vue/compiler-sfc: ^3.5.19 => 3.5.21
    @vue/server-renderer: ^3.5.19 => 3.5.21
    vite: ^7.1.3 => 7.1.4
    vue: ^3.5.19 => 3.5.21
    vue-eslint-parser: ^10.2.0 => 10.2.0
    vue-i18n: ^11.1.11 => 11.1.11

Screenshot

No response

Additional context

No response

Validations

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