mgechev / angular-seed

🌱 [Deprecated] Extensible, reliable, modular, PWA ready starter project for Angular (2 and beyond) with statically typed build and AoT compilation
https://mgechev.github.io/angular-seed
MIT License
4.57k stars 1.45k forks source link

angular2-logger inclusion causes build.prod to fail #747

Closed edud69 closed 8 years ago

edud69 commented 8 years ago

On the latest version master branch, including library angular2-logger causes the build.prod to fail. It fails at task build.bundles.app

package.json: "dependencies": { "angular2": "2.0.0-beta.14", "angular2-jwt": "^0.1.9", "angular2-logger": "^0.2.2", // << --- ADDED "es6-module-loader": "^0.17.8", "es6-promise": "^3.1.2", "es6-shim": "0.35.0", "reflect-metadata": "0.1.2", "rxjs": "5.0.0-beta.2", "systemjs": "~0.19.25", "zone.js": "^0.6.6" }

project.config.ts constructor() : (<any>this.SYSTEM_CONFIG_DEV.paths)['angular2-logger'] = ``${this.APP_BASE}node_modules/angular2-logger/bundles/angular2-logger``;

main.ts import {Logger} from 'angular2-logger/core'; ... bootstrap(AppComponent, [ ... Logger // <--- ADDED ]);

In deb.build, everything works, but when running npm run build.prod. I get the following error: Unhandled rejection Error on fetch for angular2-logger/app/core/level.ts.js at file:///f:/A-PATH/node_modules/angular2-logger/app/core/level.ts.js Loading angular2-logger/core.js Loading dist/tmp/main.js Error: ENOENT: no such file or directory, open 'f:\A-PATH\Frontend Web\node_modules\angular2-logger\app\core\level.ts.js' at Error (native)

mgechev commented 8 years ago

The configuration should be as follows:

(<any>this.SYSTEM_CONFIG_DEV.paths)['angular2-logger/*'] = ${this.APP_BASE}node_modules/angular2-logger/bundles/angular2-logger;
edud69 commented 8 years ago

@mgechev I am still unable to build the prod project.

The build.bundles.app tries to find a file _nodemodules\angular2-logger\app\core\level.ts.js

There is no such file but a file level.ts exists. I am not sure if this is due to the configuration from tools/config/seed.config.ts

SYSTEM_BUILDER_CONFIG = {
    defaultJSExtensions: true
}
mgechev commented 8 years ago

In such case you can set defaultJSExtension to false, just like we do here.

edud69 commented 8 years ago

Thank you very much!