8000 Merge pull request #780 from t4d-io-website/master · lianxuify/log4js-node@bd7097a · GitHub
[go: up one dir, main page]

Skip to content

Commit bd7097a

Browse files
authored
Merge pull request log4js-node#780 from t4d-io-website/master
fix require.main for use with Node.js mjs modules
2 parents 51084d7 + 7e008c8 commit bd7097a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/appenders/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const tryLoading = (modulePath, config) => {
3434
const loadAppenderModule = (type, config) => coreAppenders.get(type) ||
3535
tryLoading(`./${type}`, config) ||
3636
tryLoading(type, config) ||
37-
tryLoading(path.join(path.dirname(require.main.filename), type), config) ||
37+
(require.main && tryLoading(path.join(path.dirname(require.main.filename), type), config)) ||
3838
tryLoading(path.join(process.cwd(), type), config);
3939

4040
const createAppender = (name, config) => {

0 commit comments

Comments
 (0)
0