Hey guys,
trying to figure out how to use server-side libraries to fetch some initial data in nuxtServerInit. The problem that I'm facing is that when I do something like import pg from 'pg'
or require('pg')
, webpack tries to add this logic into a client side bundle which obviously won't work (can't find module fs
, etc.)
Is there a way we can use libraries like pg
to fetch data in nuxtServerInit?
Thanks :)
<!--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/c1090">#c1090</a>)</em></sub></div>