acharkizakaria / haraka-plugin-accounting-files

Haraka plugin that "Retrieve/Store/Archive" custom information of outbound traffic
MIT License
7 stars 7 forks source link

Problem after installing plugin - incompatibility with ES Module #70

Open sebasanta opened 3 weeks ago

sebasanta commented 3 weeks ago

After installing the plugin, when I try to start Haraka I get this error: [INFO] [-] [plugins] loading accounting-files [CRIT] [-] [plugins] compiling 'accounting-files' failed [CRIT] [-] [core] node_modules/haraka-plugin-accounting-files/index.js:8 [CRIT] [-] [core] var dateFormat = require('dateformat');\r [CRIT] [-] [core] ^ [CRIT] [-] [core] [CRIT] [-] [core] Error [ERR_REQUIRE_ESM]: require() of ES Module node_modules/dateformat/lib/dateformat.js from node_modules/haraka-plugin-accounting-files/index.js not supported. [CRIT] [-] [core] Instead change the require of dateformat.js in node_modules/haraka-plugin-accounting-files/index.js to a dynamic import() which is available in all CommonJS modules. [CRIT] [-] [core] at Object. (node_modules/haraka-plugin-accounting-files/index.js:8:19)

I fixed it installing the last version of dateformat that supports CommonJS require, 4.6.3