-
-
Notifications
You must be signed in to change notification settings - Fork 648
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
Rename constants/Language
module to the right suffix, and other actions to make ESM bundlers happy.
#6130
Conversation
✅ Deploy Preview for plone-components canceled.
|
@stevepiercy a bunch of my crappy english upgrade guide paragraphs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sneridagh I think this change is fine, waiting for @stevepiercy magic for docs check
They may be crappy, but they are my favorite, just like I'm my parents' favorite son. 😉 |
Co-authored-by: Steve Piercy <web@stevepiercy.com>
constants/Language
module to the right suffix, and other actions to make ESM bundlers happy.
@sneridagh the only one that needs to have the module.export definition is razzle.config which makes use of this file as seen in https://github.com/plone/volto/blob/main/packages/volto/razzle.config.js#L23 Looking at your vite WIP https://github.com/plone/volto/pull/6050/files#diff-54808bcea9a0f79709ba2a13c85f0964d7828cb604f21a819342384570bee024 Right now with this logic the language selector no longer displays the languages options because Rather than trying to convert somehow the CJS to ESM, bring in extra babel plugins and given the need of vite for ESM module I propose to Revert your change as @wesleybl suggests Later we can better handle languages.js
|
@sneridagh @ichim-david if the file is renamed to |
@wesleybl yes it's correct that if we have language.js our babel, webpack and razzle config knows how to modify that module.exports to be correctly bundled even when it's used by razzle.config which takes this common js module format To me this makes it clear that this pull request did the opposite of what should have been done, to turn Language.js into an ESM module and only in razzle.config where it's set to require('languages') to have had some way of importing that object. Unfortunately at that time I didn't do a good enough job in understanding and testing the impact of this pull request and now we have this issue at hand. EDIT: we need to have cypress tests for the personal properties languages so that we catch potential issues in the future. We could revert this work (not with git revert the whole pull request but doing another pull request and changing back the language.js rename and then removing the upgrade notice) and worry about getting Language.js into a state that is accepted by vite later but since Victor in on a holiday we need input from @davisagli on what he proposes as well, maybe he has a better idea that what I suggested here #6130 (comment) |
@ichim-david today,
Does this mean that we still have a problem in Vite, even after this PR? Do you know how I can simulate the problem in Vite? |
@wesleybl I wrote in my reply above checkout the razzle no build vite wip pull request. Modify the language.js to use module.export instead of export default and start vite with pnpm dev. Load localhost:3000 and you will see you don't get the front page loaded due to error in language file |
@ichim-david @wesleybl Instead of changing languages.cjs, I suggest we fix loading of .cjs files. This seems to work: #6237 |
* main: Automatically add the PLIP to the PLIP project board (#6134) Fix link to renamed `src/constants/Languages.cjs` (#6135) Release 18.0.0-alpha.39 Release generate-volto 9.0.0-alpha.17 rename test-setup-config.js to test-setup-config.jsx (#6133) Cleanup Image widget and pass down `onSelectItem` prop if any (#6132) Release 18.0.0-alpha.38 Release @plone/slate 18.0.0-alpha.15 Rename `constants/Language` module to the right suffix, and other actions to make ESM bundlers happy. (#6130)
📚 Documentation preview 📚: https://volto--6130.org.readthedocs.build/