We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Remix App : Issue with Importing File: "Server-only module referenced by client"

Remix App : Issue with Importing File: "Server-only module referenced by client"

rkmsoftware
Shopify Partner
22 1 7

Hello everyone,

I'm encountering an issue while trying to import a file in my Shopify app. Specifically, I get the following error message:

Server-only module referenced by client: '../db.server' imported by route 'app/routes/app.import.jsx'

It seems like there's a conflict between server-side and client-side modules. I’ve checked my import paths and tried a few things, but I haven’t been able to resolve it.

Has anyone faced a similar issue or have any suggestions on how to fix this? Any guidance would be greatly appreciated!

Thank you!

 

Fullstack Developer
Replies 4 (4)

rkmsoftware
Shopify Partner
22 1 7

I have fixed this issue on my end. Thanks

Fullstack Developer
josafatgarciasa
Shopify Partner
4 0 0

Hey, how did you solve it? I'm experiencing the same issue

rkmsoftware
Shopify Partner
22 1 7

@josafatgarciasaDo not import shopify.server until you fetch the data using the Loader Function.

Fullstack Developer
MB-Law
Shopify Partner
6 0 2

Can you explain in more detail?