Skip to content

Commit dbc29e7

Browse files
committed
Import axios instead of require
1 parent 0bf1417 commit dbc29e7

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/swsElasticEmitter.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@
33
*/
44

55
'use strict';
6+
process.env.DEBUG='*';
67

78
const os = require('os');
89
const util = require('util');
910
const http = require('http');
1011
const url = require('url');
11-
//var request = require('request');
1212
const https = require('https');
1313
//const axios = require('axios');
14-
let axios = new Promise(async (resolve) => {
15-
const res = (await import('axios')).default;
16-
resolve(res);
14+
let axios = null;
15+
let axiosPromise = new Promise(async (resolve) => {
16+
axios = (await import('axios')).default;
17+
resolve(axios);
1718
});
1819
/*
1920
(async () => {
@@ -112,7 +113,7 @@ swsElasticEmitter.prototype.initialize = function (swsOptions) {
112113
}
113114

114115
// Check / Initialize schema
115-
Promise.resolve(axios).then( () => {
116+
Promise.resolve(axiosPromise).then( () => {
116117
this.initTemplate();
117118
});
118119
};

0 commit comments

Comments
 (0)