A boilerplate Prestashop Module to develop with Vite's HMR capabilities.
Warning
This template is still in development!
- Building once is required before installing the module and developing, the
\Vite\Loaderhelper class needs the generatedmanifest.jsonto handle the scripts and styles.
bun install
bun run build- When running with
bun run dev, the scripts will be served fromhttp://127.0.0.1:5173
This template was built with DDEV support in mind
- Mount the
/modulefolder into your/var/www/html/modulesdirectory. You can create a file in.ddev/docker-compose.mounts.ymland add your module like so:
services:
web:
volumes:
- "/ps-vite-typescript/module:/var/www/html/modules/prestashopvite"- Add the path mappings in your code editor for Xdebug
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"pathMappings": {
"/var/www/html/modules/prestashopvite": "${workspaceFolder}/src",
"/var/www/html": "/instances/prestashop/"
},
"exclude": [
"**/vendor/**/*.php",
"**/smarty_internal_template.php"
]
},
]
}-
To get jQuery's type completions, you must add
/// <reference types="jquery" />at the start of the script -
You must keep the project name in
package.jsonthe same as the module name -
If you are working with multiple vite projects at the same time, it's very recommended to change the
hmr.jsonport to avoid conflicts -
You can speed up bundling times by switching to Rolldown in
package.json, it's currently still in beta
"devDependencies": {
...
"vite": "npm:rolldown-vite@latest"
}