Skip to content

Commit

Permalink
added externals arguement
Browse files Browse the repository at this point in the history
  • Loading branch information
hasanayan committed Feb 19, 2021
1 parent 290b53f commit 58f52f2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ module.exports = {
orgName: "my-org",
projectName: "my-app",
entry: "src/single-spa-index.tsx", //defaults to src/index.js,
orgPackagesAsExternal: false // defaults to false. marks packages that has @my-org prefix as external so they are not included in the bundle
reactPackagesAsExternal: true // defaults to true. marks react and react-dom as external so they are not included in the bundle
orgPackagesAsExternal: false, // defaults to false. marks packages that has @my-org prefix as external so they are not included in the bundle
reactPackagesAsExternal: true, // defaults to true. marks react and react-dom as external so they are not included in the bundle
externals: ["react-router","react-router-dom"] // defaults to []. marks the specified modules as external so they are not included in the bundle
},
}]
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "craco-plugin-single-spa-application",
"version": "1.0.3",
"version": "1.0.4",
"description": "Convert your CRA4 project into a single-spa application without ejecting or losing update support of react-scripts",
"main": "src/index.js",
"scripts": {
Expand Down
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module.exports = {
entry,
orgPackagesAsExternal,
reactPackagesAsExternal,
externals: userExternals = [],
},
context: { env },
}) => {
Expand All @@ -33,7 +34,7 @@ module.exports = {

delete webpackConfig.optimization;

let externals = ["single-spa"];
let externals = ["single-spa", ...userExternals];

if (reactPackagesAsExternal !== false)
externals = [...externals, "react", "react-dom"];
Expand Down

0 comments on commit 58f52f2

Please sign in to comment.