maciejtreder / ng-toolkit

:star: Angular tool-box! Start your PWA in two steps! Add Serverless support for existing projects and much more
https://www.angular-universal-pwa.maciejtreder.com
MIT License
1.12k stars 156 forks source link

Fresh Angular Install With Universal Not Working src/@nguniversal/module-map-ngfactory-loader.ts #738

Open tmk1991 opened 4 years ago

tmk1991 commented 4 years ago

I'm submitting a...


[X] Bug report  
[ ] Feature request
[ ] Documentation issue or request

In package


[ ] @ng-toolkit/init
[ ] @ng-toolkit/serverless
[X] @ng-toolkit/universal
[ ] @ng-toolkit/pwa
[ ] @ng-toolkit/firebug

Current behavior

On fresh install getting error

Error: ENOENT: no such file or directory, open 'src/@nguniversal/module-map-ngfactory-loader.ts'
    at Object.openSync (fs.js:443:3)
    at Object.readFileSync (fs.js:343:35)
    at Module.<anonymous> (/Users/user/workspace/some-app/dist/prerender.js:2846:29)
    at __webpack_require__ (/Users/user/workspace/some-app/dist/prerender.js:21:30)
    at /Users/user/workspace/some-app/dist/prerender.js:85:18
    at Object.<anonymous> (/Users/user/workspace/some-app/dist/prerender.js:88:10)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)

Expected behavior

Should be able to run pre-render on vanilla install

Minimal reproduction of the problem with instructions

ng new some-app
cd some-app`
ng add @ng-toolkit/universal
npm run build:prerender

Example repository

{
  "name": "some-app",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "compile:server": "webpack --config webpack.server.config.js --progress --colors",
    "serve:ssr": "node local.js",
    "build:ssr": "npm run build:client-and-server-bundles && npm run compile:server",
    "build:client-and-server-bundles": "ng build --prod && ng run lyf-site:server:production --bundleDependencies all",
    "server": "node local.js",
    "build:prod": "npm run build:ssr",
    "serve:prerender": "node static.js",
    "build:prerender": "npm run build:prod && node dist/prerender.js"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~8.2.9",
    "@angular/common": "~8.2.9",
    "@angular/compiler": "~8.2.9",
    "@angular/core": "~8.2.9",
    "@angular/forms": "~8.2.9",
    "@angular/platform-browser": "~8.2.9",
    "@angular/platform-browser-dynamic": "~8.2.9",
    "@angular/platform-server": "~8.2.9",
    "@angular/router": "~8.2.9",
    "@ng-toolkit/universal": "^8.0.3",
    "@nguniversal/express-engine": "8.1.1",
    "@nguniversal/module-map-ngfactory-loader": "8.1.1",
    "express": "^4.15.2",
    "rxjs": "~6.4.0",
    "tslib": "^1.10.0",
    "zone.js": "~0.9.1",
    "@nguniversal/common": "8.1.0",
    "domino": "^2.1.3"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.803.9",
    "@angular/cli": "~8.3.9",
    "@angular/compiler-cli": "~8.2.9",
    "@angular/language-service": "~8.2.9",
    "@types/node": "~8.9.4",
    "@types/jasmine": "~3.3.8",
    "@types/jasminewd2": "~2.0.3",
    "codelyzer": "^5.0.0",
    "jasmine-core": "~3.4.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.1.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "protractor": "~5.4.0",
    "ts-loader": "^5.2.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.15.0",
    "typescript": "~3.5.3",
    "webpack-cli": "^3.1.0"
  }
}

Environment

See above package.json

0xstupig commented 4 years ago

I've got this issue too. Please fix.

michaelbaer commented 4 years ago

Me too. Please fix.

KingDarBoja commented 4 years ago

I stepped into that bug while fixing other bugs. This should be fixed in the upcoming release as seen on #745,

By the way, Happy New Year 🎉