-
Notifications
You must be signed in to change notification settings - Fork 29.9k
/
webpack-manifest-plugin-tests.ts
39 lines (37 loc) · 1.09 KB
/
webpack-manifest-plugin-tests.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { Configuration } from 'webpack';
import path = require('path');
import WebpackManifestPlugin = require('webpack-manifest-plugin');
const options: WebpackManifestPlugin.Options = {
fileName: 'manifest.json',
basePath: '/src/',
seed: {
name: 'Hello world',
},
publicPath: 'prod',
writeToFileEmit: false,
filter: file => file.isInitial,
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),
serialize: manifest => JSON.stringify(manifest, null, 2),
removeKeyHash: false,
useEntryKeys: true,
};
const c: Configuration = {
plugins: [
new WebpackManifestPlugin(),
new WebpackManifestPlugin({
fileName: 'my-manifest.json',
basePath: '/app/',
seed: {
name: 'My Manifest',
},
}),
],
};