Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: error when setting orgPackagesAsExternal=true #32

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

prma85
Copy link

@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

please merge this change

@prma85
Copy link
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