Open nx-renezwinge opened 1 year ago
Hey @nx-renezwinge , thanks for reporting the issue. I'll take this issue to the team and prioritize it.
@kevinxh this issue remains.
related to https://github.com/SalesforceCommerceCloud/pwa-kit/issues/869#issuecomment-1404130790
Hello everybody :) I see the helper method was improved and is now called findDepInStack.
Problem is, it is not used for the condition check for the renderer build config
const renderer = fse.existsSync(resolve(projectDir, 'node_modules', '@salesforce', 'pwa-kit-react-sdk')) && baseConfig('node')
Because of this we are forced to copy the whole config in a mono repository project structure. So it will be cool in a future version the line fse.existsSync(resolve(projectDir, 'node_modules', '@salesforce', 'pwa-kit-react-sdk')) will be replaced by findDepInStack('@salesforce/pwa-kit-react-sdk')
thx.
Best regards René
Summary
We refactored our project to a MonoRepo with npm workspaces. So pwa-kit-dev in root node_modules folder. If we try to build the project, we get a lot of errors with wrong module paths. So all aliases and and rules in webpack config are broken because these are using findInProjectThenSDK and the else case creates in the path a "node_modules/node_modules", so one node_modules is too much.
Steps To Reproduce
1.) Create a npm workspaces project 2.) Add as one package the pwa-kit-app 3.) npm install in root folder 4.) Try npm run build in pwa-kit-app package
Expected result
Correct alias and rules paths. Sample: /workspaces/my-project/node_modules/react
Actual result
Paths have node_modules as path segment 2 times currently, which is broken. Sample: /workspaces/my-project/node_modules/node_modules/react
EDIT: And a last problem in webpack config.js of pwa-kit-dev. Line 333 fs.existsSync(resolve(projectDir, 'node_modules', 'pwa-kit-react-sdk')) &&
pwa-kit-react-sdk can not be found in root node_modules folder. I think if findInProjectThenSDK is fixed the resolve() should be replaced by findInProjectThenSDK()