I have a react project contains two modules with 2 entry points. I have configured the web pack in a way to create two bundles (js) in the output folder like below.
dist
- Project Output 1
- index.js
- index.html
_ manifest.json
- Project Output 1
- index.js
- index.html
- manifest.json
I had created separate index.html for each bundles using chunks. Similarly, I need to create seperate manifest file for each bundle. Need help on doing that. So far I have tried filter and map in the manifest plugin but both generated manifest file contains information of both bundles.
Both manifest.json of project bundle 1 and 2 contain the same information like below.
{
//What is not intended
"path1/index.js": "path1/index.1234567890.js",
"path2/index.js": "path2/index.1234567890.js",
}
But what i wanted is each manifest file contain information about that bundle alone like below.
manifest.json - Project bundle 1
{
"path1/index.js": "path1/index.1234567890.js",
}
manifest.json - Project bundle 2
{
"path2/index.js": "path2/index.1234567890.js",
}
My web pack config looks like below.
const config = {
entry: {
ProjectOutput1: PATH1/index.jsx,
ProjectOutput2: PATH2/index.jsx,
},
output: {
filename: '[name]/index.js'
},
plugins: [
new ManifestPlugin(
fileName: 'path1/manifest.json'
),
new ManifestPlugin(
fileName: 'path2/manifest.json'
)]
};