Closed yooouuri closed 1 month ago
I've fixed this issue. You can install nightly version.
"vue-i18n": "npm:vue-i18n-nightly@10.0.0-alpha.3-5ff1b1d",
one more thing.
You need to put ssr
option in vite.config.ts
https://github.com/intlify/bundle-tools/tree/main/packages/unplugin-vue-i18n#ssr
one more thing. You need to put
ssr
option invite.config.ts
https://github.com/intlify/bundle-tools/tree/main/packages/unplugin-vue-i18n#ssr
Oops I forgot to add it in my reproducible example.
Im going to test it, thanks!
"vue-i18n": "npm:vue-i18n-nightly@10.0.0-alpha.3-5ff1b1d"
vite config
export default defineConfig(({ isSsrBuild }) => {
...
VueI18nPlugin({
include: [path.resolve(__dirname, './src/locales/**')],
ssr: isSsrBuild ?? false,
}),
...
})
Added a console.log({ NODE_ENV: process.env.NODE_ENV })
to server.js and set isProd
to true
.
{ NODE_ENV: undefined }
http://localhost:6173
<ref *1> Object [global] {
global: [Circular *1],
queueMicrotask: [Function: queueMicrotask],
clearImmediate: [Function: clearImmediate],
setImmediate: [Function: setImmediate] {
[Symbol(nodejs.util.promisify.custom)]: [Getter]
},
structuredClone: [Function: structuredClone],
clearInterval: [Function: clearInterval],
clearTimeout: [Function: clearTimeout],
setInterval: [Function: setInterval],
setTimeout: [Function: setTimeout] {
[Symbol(nodejs.util.promisify.custom)]: [Getter]
},
atob: [Function: atob],
btoa: [Function: btoa],
performance: Performance {
nodeTiming: PerformanceNodeTiming {
name: 'node',
entryType: 'node',
startTime: 0,
duration: 2640.751667022705,
nodeStart: 3.6312090158462524,
v8Start: 6.716041922569275,
bootstrapComplete: 22.280874967575073,
environment: 13.79841697216034,
loopStart: 25.462584018707275,
loopExit: -1,
idleTime: 2420.212333
},
timeOrigin: 1715067688929.66
},
fetch: [AsyncFunction: fetch],
__VUE_HMR_RUNTIME__: {
createRecord: [Function (anonymous)],
rerender: [Function (anonymous)],
reload: [Function (anonymous)]
},
__VUE_INSTANCE_SETTERS__: [ [Function (anonymous)], [Function (anonymous)] ],
__VUE_SSR_SETTERS__: [ [Function (anonymous)], [Function (anonymous)] ],
__VUE_PROD_DEVTOOLS__: false,
__INTLIFY_PROD_DEVTOOLS__: false,
__VUE__: true
}
@kazupon but if you change isProd
to false in https://github.com/yooouuri/devtools-memory-leak-ssr-vue-i18n/blob/main/server.js#L11
And run node server.js
, the __VUE_DEVTOOLS_PLUGINS__
array is getting populated, on every request. This will result in a memory leak.
First time:
After a few refreshes:
but if you change isProd to false in
That is because you have set the flag to development instead of production. That is why ssr
in unplugin-vue-i18n in vite.config.ts is not set to true.
close, since already fixed latest version. if you have still issue, you can open as new issue thanks!
Reporting a bug?
The global
__VUE_DEVTOOLS_PLUGINS__
array expands on every request, thus creates a memory leak.Also when the project is build with mode = production, should
NODE_ENV=production
still be needed?Expected behavior
__VUE_DEVTOOLS_PLUGINS__
should not be present when vite builds with production and there should be no memory leak.Reproduction
Run without
NODE_ENV=production
and withSystem Info
Screenshot
Additional context
global without NODE_ENV=production
with NODE_ENV=production
Validations