Why is client file processed on server?

I have been trying to identify where this is coming from, but to no avail and need your help to help me to figure this out. On regular basis I get the error bellow in my server logs. So far I have failed to reproduce it locally. From what I’m seeing, the server tries to get the icon file, which is client-only. I’ve even put the package into recompile in package.json, just to make sure that it is fine:

"nodeModules": {
      "recompile": {
        "@literary-universe/styled-icons": "client"
      }
    },
2024-08-10 18:41:40+02:00 Error: ENOENT: no such file or directory, open '/app/bundle/programs/web.browser/dynamic/node_modules/@literary-universe/styled-icons/ArrowBack/ArrowBack.js'
2024-08-10 18:41:40+02:00 at readFileSync (node:fs:448:20)
2024-08-10 18:41:40+02:00 at read (packages/dynamic-import.js:208:29)
2024-08-10 18:41:40+02:00 at walk (packages/dynamic-import.js:159:14)
2024-08-10 18:41:40+02:00 at packages/dynamic-import.js:166:22
2024-08-10 18:41:40+02:00 at Array.forEach (<anonymous>)
2024-08-10 18:41:40+02:00 at walk (packages/dynamic-import.js:164:23)
2024-08-10 18:41:40+02:00 at packages/dynamic-import.js:166:22
2024-08-10 18:41:40+02:00 at Array.forEach (<anonymous>)
2024-08-10 18:41:40+02:00 at walk (packages/dynamic-import.js:164:23)
2024-08-10 18:41:40+02:00 at packages/dynamic-import.js:166:22
2024-08-10 18:41:40+02:00 at Array.forEach (<anonymous>)
2024-08-10 18:41:40+02:00 at walk (packages/dynamic-import.js:164:23)
2024-08-10 18:41:40+02:00 at packages/dynamic-import.js:166:22
2024-08-10 18:41:40+02:00 at Array.forEach (<anonymous>)
2024-08-10 18:41:40+02:00 at walk (packages/dynamic-import.js:164:23)
2024-08-10 18:41:40+02:00 at packages/dynamic-import.js:166:22
2024-08-10 18:41:40+02:00 at Array.forEach (<anonymous>)
2024-08-10 18:41:40+02:00 at walk (packages/dynamic-import.js:164:23)
2024-08-10 18:41:40+02:00 at readTree (packages/dynamic-import.js:187:10)
2024-08-10 18:41:40+02:00 at IncomingMessage.<anonymous> (packages/dynamic-import.js:101:37)
2024-08-10 18:41:40+02:00 at IncomingMessage.emit (node:events:519:28)
2024-08-10 18:41:40+02:00 at IncomingMessage.emit (node:domain:488:12)

The icon package itself is here:

Any idea what I’m doing wrong or how to find how this error is triggered? I’m on Meteor 3. I have checked and the icons are not imported in any of the server files.

A couple of things in mind:

  1. SSR

  2. Dynamic import of a page that imports the package

For #2, it’s also possible that there’s a difference between legacy and modern bundle and one bundle doesn’t have the dynamically imported files

1 Like

Don’t have SSR and the package should only be imported on React components.

Dynamic import works on client files

Check all your bundles (i.e. modern, legacy), and the file as indicated in the error above does not exist in one or all bundles.