You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to implement Universal with a project structure like:
workspace
projects
foo
shared
lib
shared.service.ts
public_api.ts <!-- this exports the shared.service.ts
src
...
I ran ng add @nguniversal/express-engine --clientProject foo standing in workspace and it added all the files it should. Here's where I stumbled upon two issues:
Running npm run build:ssr && npm run serve:ssr directly after the previous command results in it building the workspace project instead of projects/foo which was specified as the --clientProject.
I changed the following line:
"build:client-and-server-bundles": "ng build --prod && ng run foo:server:production"
To:
"build:client-and-server-bundles": "ng build foo --prod && ng run foo:server:production"
And it builds the correct project, this should be default behaviour shouldn't it?
In the foo project I'm importing things from shared, but these imports doesn't work when I run npm run build:ssr && npm run serve:ssr. All I get is:
$ ng new workspace
$ cd workspace
$ ng generate application foo
$ ng add @nguniversal/express-engine --clientProject foo
$ ng generate library shared
$ ng build shared
Add import {SharedService} from 'shared'; to projects/foo/src/app/app.component.ts.
Change package.json line 14 to:
"build:client-and-server-bundles": "ng build foo --prod && ng run foo:server:production"
Run npm run build:ssr && npm run serve:ssr.
🔥 Exception or Error
ERROR in projects/foo/src/app/app.component.ts(3,29): error TS2307: Cannot find module 'shared'.
🐞 Bug report
Command (mark with an
x
)Is this a regression?
Not sure.
Description
I'm trying to implement Universal with a project structure like:
I ran
ng add @nguniversal/express-engine --clientProject foo
standing in workspace and it added all the files it should. Here's where I stumbled upon two issues:npm run build:ssr && npm run serve:ssr
directly after the previous command results in it building the workspace project instead ofprojects/foo
which was specified as the--clientProject
.I changed the following line:
To:
And it builds the correct project, this should be default behaviour shouldn't it?
foo
project I'm importing things fromshared
, but these imports doesn't work when I runnpm run build:ssr && npm run serve:ssr
. All I get is:This is strange to me since the library works great when just serving the
foo
project normally.🔬 Minimal Reproduction
Repo found here: https://github.com/chrillewoodz/universal-library-repro
Add
import {SharedService} from 'shared';
toprojects/foo/src/app/app.component.ts
.Change
package.json
line 14 to:"build:client-and-server-bundles": "ng build foo --prod && ng run foo:server:production"
Run
npm run build:ssr && npm run serve:ssr
.🔥 Exception or Error
🌍 Your Environment
The text was updated successfully, but these errors were encountered: