[Pkg-javascript-devel] Bug#1011279: Bug#1011279: node-dateformat CJS file does not provide the same API than ES file
Pirate Praveen
praveen at onenetbeyond.org
Thu May 19 16:56:11 BST 2022
On Thu, 19 May 2022 15:59:27 +0200 Yadd <yadd at debian.org> wrote:
> On 19/05/2022 15:50, Yadd wrote:
> > Package: node-dateformat
> > Version: 5.0.3-1
> > Severity: serious
> > Tags: ftbfs
> > Justification: FTBFS
> > Control: affects -1 grunt node-lightgallery
> >
> > Following upstream doc, `import d from 'dateformat'` is a
function. The
> > file built with `babeljs --plugins
@babel/transform-modules-commonjs`
> > produces an Object, usable function is d.default. This breaks
grunt (try
> > to build node-lightgallery for example).
> >
> > This can be fixed using `mjs2cjs -a` and a custom
`debian/index.cjs`
>
> Grunt code:
>
> // lib/grunt/template.js
> template.date = require('dateformat');
>
> // ...
> return template.date(now, format);
> // => error: template.date is not a function
>
>
This can be fixed in grunt with a patch,
cat debian/patches/fix-for-dateformat5.patch
--- a/lib/grunt/template.js
+++ b/lib/grunt/template.js
@@ -6,7 +6,7 @@
var template = module.exports = {};
// External libs.
-template.date = require('dateformat');
+template.date = require('dateformat').default;
// Format today's date.
template.today = function(format) {
I think it is better to fix it in grunt.
More information about the Pkg-javascript-devel
mailing list