Import "server side module" in page problem #16607
-
Describe the bugI feel like I miss something, but when I import a custom script (which itself import the node-persist module as follow
I do this import (the custom script) in order to use an async function in getServerSideProps. To ReproduceJust import node-persist in a page. Expected behaviorShould be able to import a custom script importing "server side" modules itself (I say server side because it handles files). System informationEverything is to the latest version. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Found what was going wrong. Just make sure you call everything (functions, etc) coming from that import into the getServerSideProps function so Next.js knows it is to be bundled server side (and excluded client side). |
Beta Was this translation helpful? Give feedback.
Found what was going wrong. Just make sure you call everything (functions, etc) coming from that import into the getServerSideProps function so Next.js knows it is to be bundled server side (and excluded client side).