diff --git a/types/webpack-manifest-plugin/index.d.ts b/types/webpack-manifest-plugin/index.d.ts index c0d9067a1c..59222d838e 100644 --- a/types/webpack-manifest-plugin/index.d.ts +++ b/types/webpack-manifest-plugin/index.d.ts @@ -77,7 +77,7 @@ declare namespace WebpackManifestPlugin { /** * Sort files before they are passed to generate. */ - sort?: (file: FileDescriptor) => number; + sort?: (a: FileDescriptor, b: FileDescriptor) => number; /** * Create the manifest. It can return anything as long as it's serialisable by JSON.stringify. diff --git a/types/webpack-manifest-plugin/webpack-manifest-plugin-tests.ts b/types/webpack-manifest-plugin/webpack-manifest-plugin-tests.ts index 3c34f052fa..b52ae5555b 100644 --- a/types/webpack-manifest-plugin/webpack-manifest-plugin-tests.ts +++ b/types/webpack-manifest-plugin/webpack-manifest-plugin-tests.ts @@ -14,14 +14,12 @@ const options: WebpackManifestPlugin.Options = { map: (file) => { if (file.name) { file.name = path.join(path.dirname(file.path), file.name); - return file; - } - }, - reduce: (manifest, { name, path }) => { - if (name) { - return { ...manifest, [name]: path }; } + return file; }, + sort: (a, b) => a.path.localeCompare(b.path), + generate: (seed, files) => files.reduce((manifest, {name, path}) => name ? {...manifest, [name]: path} : manifest, seed), + serialize: (manifest) => JSON.stringify(manifest, null, 2) }; const c: Configuration = {