Home

Issue: 1236

How to use server-side libraries like pg in nuxtServerInit?

[issue link]

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 😃

This question is available on Nuxt.js community (#c1090)