Volto Hands-on question: MainSlider?

In the section on Blocks, it’s telling us to override MainSlider by creating the directory src/components/Blocks/MainSlider, but that throws an error:


!(function webpackMissingModule() { var e = new Error("Cannot find module '@package/components/Blocks/MainSlider/View'"); e.code = 'MODULE_NOT_FOUND'; throw e; }());

Cannot find module '@package/components/Blocks/MainSlider/View'

Looking in the omelette/src/components/manage/Blocks directory there is no MainSlider component to override. Am I missing something?


The section to which you linked isn't about overriding existing blocks but creating new ones. So next question is: did you add a View.jsx file inside YOUR_VOLTO_PROJECT_DIR/src/components/Blocks/MainSlider (not YOUR_PLONE_DIR/omelette/anything)? Same for Edit.jsx, as per the linked tutorial.

If your goal was overriding you'd look for Component Shadowing, a technique where you rename existing Volto components (or actions/reducers) by copying them to src/customizations with a filename reflecting their original path. For example, copying src/components/manage/Blocks/LeadImage/LeadImageSidebar.jsx to src/customizations/components.manage.Blocks.LeadImage.LeadImageSidebar.jsx

1 Like

Plone Foundation Code of Conduct