Skip to content

Commit

Permalink
added named chunkIds option
Browse files Browse the repository at this point in the history
  • Loading branch information
hasanayan committed Oct 7, 2021
1 parent fa084a7 commit ea0f69f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Add module-federation support to your CRA5 project without ejecting and losing u
## Install

```
npm install craco-module-federation@latest --save-dev
npm install craco-module-federation --save-dev
```

## Usage
Expand All @@ -26,8 +26,9 @@ cracoModuleFederation = require('craco-module-federation');
module.exports = {
plugins: [{
plugin: cracoModuleFederation,
options: { useNamedChunkIds:true } //THIS LINE IS OPTIONAL
},
}]
]
}
```

Expand Down
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@ const getModuleFederationConfigPath = (additionalPaths = []) => {
};

module.exports = {
overrideWebpackConfig: ({ webpackConfig }) => {
overrideWebpackConfig: ({ webpackConfig, pluginOptions }) => {
const moduleFederationConfigPath = getModuleFederationConfigPath();

if (moduleFederationConfigPath) {
webpackConfig.output.publicPath = "auto";

if (pluginOptions?.useNamedChunkIds) {
webpackConfig.optimization.chunkIds = "named";
}

const htmlWebpackPlugin = webpackConfig.plugins.find(
(plugin) => plugin.constructor.name === "HtmlWebpackPlugin"
);
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "craco-module-federation",
"version": "1.1.0-rc.2",
"version": "1.1.0",
"description": "Add module federation support to your CRA5 application without ejecting",
"repository": {
"type": "git",
Expand Down

0 comments on commit ea0f69f

Please sign in to comment.