8000 docs: webpack workaround doc · xyz-data/log4js-node@eac84c4 · GitHub
[go: up one dir, main page]

Skip to content

Commit eac84c4

Browse files
committed
docs: webpack workaround doc
1 parent 069d94a commit eac84c4

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

docs/webpack.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Working with webpack
2+
3+
Log4js uses dynamic require for loading appenders. Webpack doesn't know at build time which appender will be used at runtime so a small workaround is necessary.
4+
5+
```
6+
const stdout = require('log4js/lib/appenders/stdout');
7+
import * as Configuration from 'log4js/lib/configuration';
8+
9+
Configuration.prototype.loadAppenderModule = function(_type: string): void {
10+
return stdout;
11+
};
12+
```
13+

0 commit comments

Comments
 (0)
0