Closed xmeng1 closed 6 years ago
ng2-logger doesn't require 'fs' use 'ng2-logger/browser'
Getting the same error btw after updating to AG6
@darekf77 nope you are wrong it does https://github.com/darekf77/ng2-logger/blob/3cebe387612d25c48ea5348742672017f89bb4fa/src/backend-logging.ts#L14
@jimmykane check if somewhere in your code you are not refering to ng2-logger instead of ng2-logger/browser
@darekf77 just a few mins ago solved this. I was indeed using the ng2-logger
but not correct.
I had -import {Log, Level} from 'ng2-logger'
while it should have been +import {Log, Level} from 'ng2-logger/client'
Thanks for looking into this
@darekf77 Got the error after upgrading to Angular 6. I was using import {Log, Level} from 'ng2-logger'
. After changing to import {Log, Level} from 'ng2-logger/client'
or import {Log, Level} from 'ng2-logger/browser'
, ng serve
is working but not for ng build
. Do you have any solution?
@jimmykane Is your solution working for you when running ng build
?
@tianchez yup. Only import from client
@tianchez with ng build AOT is enable by default... try without AOT... In next week I am going to release version with AOT support - with proper package.json and js modules produced by https://github.com/dherges/ng-packagr.
@darekf77 I am building for prod and it's ok. (AOT enabled)
@darekf77 You are right. It works without AOT for me. To be specific, I got this error when building with ng build --prod
However, if I build with ng build --prod --aot=false --build-optimizer=false
, no errors showing up
I'm using Angular @angular/core": "^6.0.3
with @angular/cli": "~6.0.7
and I'm getting:
ERROR in ./node_modules/ng2-logger/backend-logging.js
Module not found: Error: Can't resolve 'fs' in '/home/tepo/IdeaProjects/OneDMS-GUI/node_modules/ng2-logger'
ERROR in ./node_modules/ng2-logger/display.js
Module not found: Error: Can't resolve 'path' in '/home/tepo/IdeaProjects/OneDMS-GUI/node_modules/ng2-logger'
ERROR in ./node_modules/ng2-logger/backend-logging.js
Module not found: Error: Can't resolve 'path' in '/home/tepo/IdeaProjects/OneDMS-GUI/node_modules/ng2-logger'
ℹ 「wdm」: Failed to compile.
when I run ng serve
I'm importing from client: import {Log} from 'ng2-logger/client'
Because ng2-logger require 'fs', and ng test fails Module not found: Error: Can't resolve 'fs' (see this issue https://github.com/angular/angular-cli/issues/8357 and this https://github.com/webpack-contrib/css-loader/issues/447. Maybe need to update the document and let user add configuration to the
karma.conf.js
if the user wants to use karma to test angular.