Static GitHub Issues

[884] Exclude nuxtServerInit from client bundles?

prev: Add example with vuefire or vuexfire
next: Async Data fails when reload page (server-side rendering)

Is there a recommended way to exclude nuxtServerInit code from the client bundle?

I'm using that function to decrypt a cookie which uses iron to prepopulate my user's session data,, and that brings with it a whole host of Node dependencies. Many of those deps are written ES6, so uglifyjs throws errors and can't eliminate the code.

I think it would be a good idea to prevent that code from being sent to the client, since in this and presumably other cases, it leaks info about the backend to the client.

My current thought was to spilt my nuxtServerInit code into a new file, and somehow configure webpack to import a fake version of it when building the client bundles.

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c754">#c754</a>)</em></sub></div>