我的代码如下:
'use strict';
import('mysql').then(result => console.log('then'))
.catch(error => console.log('catch'));
console.log(require('mysql'));
When I run node thisScript.js
, the console output is this:
{
createConnection: [Function: createConnection],
createPool: [Function: createPool],
createPoolCluster: [Function: createPoolCluster],
createQuery: [Function: createQuery],
escape: [Function: escape],
escapeId: [Function: escapeId],
format: [Function: format],
raw: [Function: raw]
}
catch
If I remove the line with require('mysql')
, the console output is just catch
.