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 require used in virtualModuleModernEntry template #17108
Conversation
When **package.json** contains `{ "type": "module" }`, the build fails with `Uncaught ReferenceError: require is not defined`. Fixes #14877 We'd still need to ensure that all the imported files have their extension specified (`.js`).
☁️ Nx Cloud ReportWe didn't find any information for the current pull request with the commit cde0867. Check the Nx Cloud Github Integration documentation for more information. Sent with 💌 from NxCloud. |
@alexgrozav sorry about the delays here, I'm just back from leave and things have been busy. Thank you for this and I really want to take a closer look. |
@tmeasday No worries. Hope it helps and works as expected. :) |
Hmm, interesting solution. There is an almost-merged alternative here: #16727 This PR is in line with what the Vite builder does ( It does (unnecessarily I guess) change the behaviour of SB though -- now it needs to go and fetch the project annotations on bootup (every time) rather than having them in the initial bundle. That seems unnecessary to get round a technical issue, so I think I will close this in favour of the other PR, but keep this in the back pocket in case that one doesn't work out! Thanks @alexgrozav! |
Perfectly understandable. Better to have the two builders aligned. Cheers! :) |
Oh! Actually I think maybe my comment above was ambiguous and it is the other way round :) |
@Andarist do you have a reproduction? We could reconsider doing this PR. |
Issue: #14877
When package.json contains
{ "type": "module" }
, the build fails withUncaught ReferenceError: require is not defined
.What I did
Used
async/await
to import all configuration files in bulk, maintaining the same functionality.We'd still need to ensure that all the imported files have their extension specified (
.js
).