Open bruceauyeung opened 5 years ago
I think this is related to webpack
and your project's configuration. I tested this in a newly created create react app
project and I get the same issue. In the same project, if I run node -e "const { format } = require('winston'); console.log(format.errors);"
I can see that the function does indeed exist. When running the react app, I get the error in the browser's console.
Related: https://github.com/winstonjs/logform/issues/97
So not related to webpack
. It's just the errors
formatter is not being exposed to the browser by logform
.
@rhyek today i tried to reproduce this bug, and like you said, format.errors function is not available in electron renderer process
even when nodeIntegration
is true
Please tell us about your environment:
I am using winston in an Electron application, based on VueJS framework, typescript class style
winston
version?winston@2
winston@3
winston@3.2.1node -v
outputs: v12.4.0What is the problem?
when running, there is an error: logger.ts:9 Uncaught TypeError: winston__WEBPACK_IMPORTED_MODULE_0__.format.errors is not a function
my code:
format.err
, vscode will suggest meerrors
, auto-completion looks good.What do you expect to happen instead?
there shouldn't be an error related to
errors
function