Merge pull request #780 from t4d-io-website/master

fix require.main for use with Node.js mjs modules
This commit is contained in:
Gareth Jones 2018-10-02 07:38:17 +10:00 committed by GitHub
commit bd7097a8a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,7 +34,7 @@ const tryLoading = (modulePath, config) => {
const loadAppenderModule = (type, config) => coreAppenders.get(type) ||
tryLoading(`./${type}`, config) ||
tryLoading(type, config) ||
tryLoading(path.join(path.dirname(require.main.filename), type), config) ||
(require.main && tryLoading(path.join(path.dirname(require.main.filename), type), config)) ||
tryLoading(path.join(process.cwd(), type), config);
const createAppender = (name, config) => {