darekf77 / ng2-logger

Isomorphic logger for Browser and NodeJS, ( typescript / javascript ) apps
MIT License
61 stars 17 forks source link

Can't build with angular 12 and npm 7 #57

Closed Jahrenski closed 3 years ago

Jahrenski commented 3 years ago

Basically my build fails for angular 12 / npm 7 because the package.json declares the following: "main": "esm2015/index.js" But no such file exists in the folder after npm install

Any idea how to fix this?

Thanks!

Error: Failed to compile entry-point ng2-logger ('main' as unknown format) due to property 'main' pointing to a missing or empty file: esm2015/index.js at C:\WS\Angular\MyApp\node_modules\@angular\compiler-cli\ngcc\src\execution\tasks\completion.js:57:19 at C:\WS\Angular\MyApp\node_modules\@angular\compiler-cli\ngcc\src\execution\tasks\completion.js:31:13 at C:\WS\Angular\MyApp\node_modules\@angular\compiler-cli\ngcc\src\execution\create_compile_function.js:47:21 at SingleProcessExecutorSync.SingleProcessorExecutorBase.doExecute (C:\WS\Angular\MyApp\node_modules\@angular\compiler-cli\ngcc\src\execution\single_process_executor.js:36:17) at C:\WS\Angular\MyApp\node_modules\@angular\compiler-cli\ngcc\src\execution\single_process_executor.js:57:59 at SyncLocker.lock (C:\WS\Angular\MyApp\node_modules\@angular\compiler-cli\ngcc\src\locking\sync_locker.js:34:24) at SingleProcessExecutorSync.execute (C:\WS\Angular\MyApp\node_modules\@angular\compiler-cli\ngcc\src\execution\single_process_executor.js:57:27) at Object.mainNgcc (C:\WS\Angular\MyApp\node_modules\@angular\compiler-cli\ngcc\src\main.js:74:25) at Object.process (C:\WS\Angular\MyApp\node_modules\@angular\compiler-cli\ngcc\index.js:29:23) at NgccProcessor.processModule (C:\WS\Angular\MyApp\node_modules\@ngtools\webpack\src\ngcc_processor.js:175:16) at C:\WS\Angular\MyApp\node_modules\@ngtools\webpack\src\ivy\host.js:146:18 at C:\WS\Angular\MyApp\node_modules\@ngtools\webpack\src\ivy\host.js:76:24 at Array.map (<anonymous>) at Object.host.resolveModuleNames (C:\WS\Angular\MyApp\node_modules\@ngtools\webpack\src\ivy\host.js:74:32) at C:\WS\Angular\MyApp\node_modules\@ngtools\webpack\src\ivy\host.js:75:55 at Array.map (<anonymous>) An unhandled exception occurred: Failed to compile entry-point ng2-logger ('main' as unknown format) due to property 'main' pointing to a missing or empty file: esm2015/index.js

EDIT: As an added note, when I manually copy the file node_modules/ng2-logger/index.js into ./client/esm2015/ and ./browser/esm2015 folders, the ngcc compilation is successful. The same needs to be done with helper.js for the angular build to succeed.

I would make a Pull request but I don't understand the build system used in this project.

darekf77 commented 3 years ago

@Jahrenski I am working on this...

darekf77 commented 3 years ago

@Jahrenski let me know if new version is working for u.

Jahrenski commented 3 years ago

@darekf77 Works perfectly! Thanks!

Jahrenski commented 2 years ago

Just wanted to let you know that this also works for Angular 13 that was recently released! Good work!