SSR deployment broken
Closed this issue · 3 comments
The following commits broke the SSR server deployment:
7d59edf
d85b670
If I run node dist/server.js
in my dev folder, it works. However if I move dist folder outside of my dev folder (such as on desktop or on my server), the server.js no longer works. This is the error I am getting:
Error: Cannot find module 'zone.js/dist/zone-node'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (c:\Users\Admin\Downloads\dist\server.js:4:1)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
The problem seems to be that node_modules
is not bundled at all to the server.js file. If I copy the node_modules to the folder it expects on the server, everything suddenly works. It does not seem right to be deploying node_modules to production server.
Have you found the workaround for this?
@sskhokhar Workaround is to write my own webpack.config.js to do the necessary bundling. Haven't done that yet. Using the webpack config that was used by universal-starter before the changes would get you 99% there I guess.