Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR in ./server.ts Module not found: Error: Can't resolve './dist/server/main.bundle' in ... @ ./server.ts 16:9-45

I followed the angular universal guide (https://angular.io/guide/universal)

When I execute:

npm run build:universal

I got this error:

ERROR in ./server.ts Module not found: Error: Can't resolve './dist/server/main.bundle' in ...  @ ./server.ts 16:9-45

npm run build:client-and-server-bundles

works fine but

npm run webpack:server 

fails

Question: Is it normal, that no dist folder is created when I execute the command?

like image 248
Maurice Avatar asked Jan 03 '18 02:01

Maurice


1 Answers

Need to change path inside file tsconfig.server.json

From

 "files": [
    "src/main.server.ts",
    "server.ts"
  ],

TO

   "files": [
       "main.server.ts",
        "../server.ts"
    ],

Other configuration should match with

https://github.com/angular/angular-cli/wiki/stories-universal-rendering

like image 140
mabdullahse Avatar answered Oct 14 '22 07:10

mabdullahse