Skip to content

fix: error when setting orgPackagesAsExternal=true#32

Open
prma85 wants to merge 1 commit into
hasanayan:mainfrom
prma85:main
Open

fix: error when setting orgPackagesAsExternal=true#32
prma85 wants to merge 1 commit into
hasanayan:mainfrom
prma85:main

Conversation

@prma85
Copy link
Copy Markdown

@prma85 prma85 commented May 26, 2023

Fix the error when setting the orgPackagesAsExternal option as true

Example

const orgName = 'myorg'

const singleSpaAppPlugin = {
  plugin: SingleSpaAppcracoPlugin,
  options: {
    orgName,
    projectName: 'container',
    entry: 'src/index.tsx', //defaults to src/index.js,
    orgPackagesAsExternal: true, // 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
    minimize:  process.env.IS_LOCAL !== 'true', // defaults to false, sets optimization.minimize value
    outputFilename: `${orgName }-container.js`, // defaults to the values set for the "orgName" and "projectName" properties, in this case "my-org-my-app.js"
  },
}

Error

ReferenceError: orgName is not defined
    at buildExternals (C:\Users\pandrade\Documents\GitHub\console-container\node_modules\craco-plugin-single-spa-application\src\override-webpack-config.js:48:36)
    at Object.overrideWebpackConfig (C:\Users\pandrade\Documents\GitHub\console-container\node_modules\craco-plugin-single-spa-application\src\override-webpack-config.js:102:29)
    at overrideWebpack (C:\Users\pandrade\Documents\GitHub\console-container\node_modules\@craco\craco\dist\lib\features\plugins.js:36:38)       
    at C:\Users\pandrade\Documents\GitHub\console-container\node_modules\@craco\craco\dist\lib\features\plugins.js:53:29
    at Array.forEach (<anonymous>)
    at applyWebpackConfigPlugins (C:\Users\pandrade\Documents\GitHub\console-container\node_modules\@craco\craco\dist\lib\features\plugins.js:52:29)
    at mergeWebpackConfig (C:\Users\pandrade\Documents\GitHub\console-container\node_modules\@craco\craco\dist\lib\features\webpack\merge-webpack-config.js:119:70)
    at overrideWebpackDev (C:\Users\pandrade\Documents\GitHub\console-container\node_modules\@craco\craco\dist\lib\features\webpack\override.js:8:80)
    at C:\Users\pandrade\Documents\GitHub\console-container\node_modules\@craco\craco\dist\scripts\start.js:23:39

Node.js v18.16.0

@shuhaib-aot
Copy link
Copy Markdown

please merge this change

@prma85
Copy link
Copy Markdown
Author

prma85 commented Jul 18, 2023

@hasanayan @felipeplets @Tomyail @boakenfull
Any chance to get this one merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants