Skip to content

Commit

Permalink
Update webpack-manifest-plugin for Webpack 5
Browse files Browse the repository at this point in the history
  • Loading branch information
alex996 committed Dec 11, 2020
1 parent 17c5828 commit d6be528
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
8 changes: 4 additions & 4 deletions types/webpack-manifest-plugin/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
// Definitions by: Andrew Makarov <https://github.com/r3nya>, Jeremy Monson <https://github.com/monsonjeremy>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

import { Plugin, compilation, Compiler } from 'webpack';
import { WebpackPluginInstance, compilation, Compiler } from 'webpack';
import { SyncWaterfallHook } from 'tapable';

export class WebpackManifestPlugin extends Plugin {
constructor(options?: Options);
}
export const WebpackManifestPlugin: {
new (options?: Options): WebpackPluginInstance;
};

export interface FileDescriptor {
/** Only available if isChunk is true. */
Expand Down
22 changes: 12 additions & 10 deletions types/webpack-manifest-plugin/webpack-manifest-plugin-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,34 @@ import path = require('path');
import { WebpackManifestPlugin, Options } from 'webpack-manifest-plugin';

const options: Options = {
fileName: 'manifest.json',
basePath: '/src/',
seed: {
name: 'Hello world',
},
publicPath: 'prod',
writeToFileEmit: false,
fileName: 'manifest.json',
filter: file => file.isInitial,
generate: (seed, files, entries) =>
files.reduce((manifest, { name, path }) => (name ? { ...manifest, [name]: path } : manifest), seed),
map: file => {
if (file.name) {
file.name = path.join(path.dirname(file.path), file.name);
}
return file;
},
sort: (a, b) => a.path.localeCompare(b.path),
generate: (seed, files) =>
files.reduce((manifest, { name, path }) => (name ? { ...manifest, [name]: path } : manifest), seed),
publicPath: 'prod',
removeKeyHash: /[a-Z0-9]/g,
seed: {
name: 'Hello world',
},
serialize: manifest => JSON.stringify(manifest, null, 2),
sort: (a, b) => a.path.localeCompare(b.path),
useEntryKeys: true,
writeToFileEmit: false,
};

const c: Configuration = {
plugins: [
new WebpackManifestPlugin(),
new WebpackManifestPlugin({
fileName: 'my-manifest.json',
basePath: '/app/',
fileName: 'my-manifest.json',
seed: {
name: 'My Manifest',
},
Expand Down

0 comments on commit d6be528

Please sign in to comment.