docs
docs copied to clipboard
Javascript component aliases
PrestaShop javascript components are now accessible via aliases We need to explain how a module can use these components and setup its module webpack environment to use them easily
Javascripts components are accessible via aliases because of our webpack configuration. Without this configuration it's not possible to use them :sweat_smile: https://github.com/PrestaShop/PrestaShop/blob/develop/admin-dev/themes/new-theme/.webpack/common.js#L108
@PierreRambaud If I understand correctly, it means modules cannot use components because they do not rely on our webpack config ? 🤔
@matks yes, modules have their own webpack config scope, aliases are not usable outside the proper webpack config scope
We could maybe provide a webpack configuration at the root of the project, or root of modules, or an array of aliases that they can easily add to their own webpack configuration, but this is really ugly and as we seen on blockwishlist last week, having dependencies from the core is breaking a lot of things (because when you build the module for example, it require to have it inside a prestashop directory which is not the case for every modules developers depending on their environement)
@matks yes, modules have their own webpack config scope, aliases are not usable outside the proper webpack config scope
We could maybe provide a webpack configuration at the root of the project, or root of modules, or an array of aliases that they can easily add to their own webpack configuration
That would be interesti,g
having dependencies from the core is breaking a lot of things (because when you build the module for example, it require to have it inside a prestashop directory
I'm afraid we wont be able to change this for now. "Module, in order to work, must be inside prestashop" is a requirement that have been here for ages so everything is done with this in mind (on both frontend and backend).
Although we should look for a long term solution for this design issue, I think for now we can "keep working with this" as fighting it makes things a lot more complex. Accepting this bad requirement make things a lot easier 😅
I created a POC of how we can provide usefull things to external developers :
https://github.com/PrestaShop/PrestaShop/pull/20313
This solution is probably the best we can do for the moment, without introducing big changes !