Ángel Araya
Ángel Araya

Reputation: 1

Angular development build does not run while prod build does

I have an Angular 13 project which uses Angular Universal (SSR). One of my dependencies (that I also develop) is for the server portion only. When building the project on development mode with ng run project:server --configuration=development the project builds but when running it I get this error:

$ node dist/project/server/main.js
/CODE/project/dist/project/server/main.js:152487
/* harmony export */   "ReadableResource": () => (/* reexport safe */ _readable__WEBPACK_IMPORTED_MODULE_2__.ReadableResource),
                                                                                                             ^

TypeError: Cannot read properties of undefined (reading 'ReadableResource')
    at Module.ReadableResource (/CODE/project/dist/project/server/main.js:152487:110)
    at Module.51801 (/CODE/project/dist/project/server/main.js:153393:64)
    at __webpack_require__ (/CODE/project/dist/project/server/main.js:278610:42)
    ...

However if I run the same builder with production configuration, there are no runtime errors and the library can be used without problems. All I have found so far is that Webpack is involved in the dev build and (maybe) not in the prod build but I don't know what to do with that.

Any help is appreciated.

Upvotes: 0

Views: 401

Answers (1)

Ghaith Troudi
Ghaith Troudi

Reputation: 248

to run angular universal app in dev mode you need to run this command:

npm run dev:ssr

or:

ng run project:serve-ssr

Upvotes: 1

Related Questions