rich-logger-decorator icon indicating copy to clipboard operation
rich-logger-decorator copied to clipboard

commonjs es6 module resolution

Open ngmariusz opened this issue 7 years ago • 8 comments

Hi, How you make it work with

       // tsconfig.json
        "module": "commonjs",
        "target": "es6",

?

ngmariusz avatar Apr 26 '17 13:04 ngmariusz

There are some problems with this configurations?

dormd avatar Apr 28 '17 07:04 dormd

My understanding is that node module must in the commonjs format - not es6 or esnext.

I get the error: rich-logger-decorator\src\index.ts:1 ({"Object.":function(module,exports,require,__dirname,__filename,global,jest){export * from './interfaces'; for the keyword 'export'.

chetmurphy avatar Jul 16 '17 17:07 chetmurphy

I'm having problems using the library as well... import { ClassLogger } from "rich-logger-decorator"; gives me the error Cannot find module 'rich-logger-decorator' on compilation, and import { ClassLogger } from "rich-logger-decorator/dist/src"; gives the same error @chetmurphy mentions above at runtime.

mrosack avatar Aug 31 '17 13:08 mrosack

This error may be appeared when the npm isn't installed. Please add a plunker

dormd avatar Aug 31 '17 15:08 dormd

Sure, here's a fresh angular cli project where i just try to add ClassLogger and it doesn't work. I think you need to compile your module to commonjs so it'll work with webpack (but I'm not an expert on these things).

https://github.com/mrosack/rich-logger-decorator-test

mrosack avatar Aug 31 '17 19:08 mrosack

+1 Not work import library. Cannot find module 'rich-logger-decorator'.

marvelsrp avatar Sep 12 '17 10:09 marvelsrp

changing main in package.json does the trick: "main": "dist/src/index.js",

nelisbijl avatar Oct 23 '17 09:10 nelisbijl

I have resolved the above mentioned issues, but I also changed the log output. I opened a PR.

Details: https://github.com/Roustalski/rich-logger-decorator/blob/master/README.md

Roustalski avatar Nov 14 '17 16:11 Roustalski