Files
DefinitelyTyped/types/webpack-manifest-plugin/webpack-manifest-plugin-tests.ts
Joshua Goldberg e007354a79 Fixed camelCasing for webpack-manifest-plugin fileName
It's listed as fileName in the docs. I think this was just a typo.
2017-11-18 15:26:21 -08:00

39 lines
957 B
TypeScript

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;
}
},
reduce: (manifest, { name, path }) => {
if (name) {
return { ...manifest, [name]: path };
}
},
};
const c: Configuration = {
plugins: [
new WebpackManifestPlugin(),
new WebpackManifestPlugin({
fileName: 'my-manifest.json',
basePath: '/app/',
seed: {
name: 'My Manifest',
},
}),
],
};