Setup usage of Vite instead of webpack for faster development

This commit is contained in:
2025-12-17 09:46:52 +01:00
parent a30232d3ce
commit 0197299c89
30 changed files with 391 additions and 347 deletions

5
.gitignore vendored
View File

@@ -62,3 +62,8 @@ yarn-error.log
/.php-cs-fixer.php
/.php-cs-fixer.cache
###< friendsofphp/php-cs-fixer ###
###> pentatrion/vite-bundle ###
/node_modules/
/public/build/
###< pentatrion/vite-bundle ###

View File

@@ -37,6 +37,7 @@
"ocramius/package-versions": "^1.10 || ^2",
"odolbeau/phone-number-bundle": "^3.6",
"ovh/ovh": "^3.0",
"pentatrion/vite-bundle": "^8.2",
"phpoffice/phpspreadsheet": "^1.16",
"ramsey/uuid-doctrine": "^1.7",
"sensio/framework-extra-bundle": "^5.5",
@@ -84,7 +85,6 @@
"symfony/twig-bundle": "^5.4",
"symfony/ux-translator": "^2.22",
"symfony/validator": "^5.4",
"symfony/webpack-encore-bundle": "^1.11",
"symfony/workflow": "^5.4",
"symfony/yaml": "^5.4",
"thenetworg/oauth2-azure": "^2.0",

View File

@@ -17,7 +17,6 @@ return [
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
Chill\ActivityBundle\ChillActivityBundle::class => ['all' => true],
@@ -37,4 +36,5 @@ return [
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
Symfony\UX\Translator\UxTranslatorBundle::class => ['all' => true],
loophp\PsrHttpMessageBridgeBundle\PsrHttpMessageBridgeBundle::class => ['all' => true],
Pentatrion\ViteBundle\PentatrionViteBundle::class => ['all' => true],
];

View File

@@ -0,0 +1,9 @@
when@dev:
_pentatrion_vite:
prefix: /build
resource: "@PentatrionViteBundle/Resources/config/routing.yaml"
_profiler_vite:
path: /_profiler/vite
defaults:
_controller: Pentatrion\ViteBundle\Controller\ProfilerController::info

View File

@@ -11,7 +11,7 @@
"@hotwired/stimulus": "^3.0.0",
"@luminateone/eslint-baseline": "^1.0.9",
"@symfony/stimulus-bridge": "^3.2.0",
"@symfony/webpack-encore": "^4.1.0",
"@vitejs/plugin-vue": "^5.1.4",
"@tsconfig/node20": "^20.1.4",
"@types/dompurify": "^3.0.5",
"@types/eslint__js": "^8.42.3",
@@ -29,20 +29,15 @@
"intl-messageformat": "^10.5.11",
"jquery": "^3.6.0",
"popper.js": "^1.16.1",
"postcss-loader": "^7.0.2",
"prettier": "^3.3.3",
"raw-loader": "^4.0.2",
"sass": "^1.89.0",
"sass-loader": "^14.0.0",
"select2": "^4.0.13",
"select2-bootstrap-theme": "0.1.0-beta.10",
"style-loader": "^3.3.1",
"ts-loader": "^9.3.1",
"typescript": "^5.6.3",
"typescript-eslint": "^8.13.0",
"vue-loader": "^17.0.0",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1"
"vite": "^6.0",
"vite-plugin-symfony": "^8.2"
},
"dependencies": {
"@fullcalendar/core": "^6.1.4",
@@ -76,10 +71,9 @@
"defaults and fully supports es6-module and not dead"
],
"scripts": {
"dev-server": "encore dev-server",
"dev": "encore dev",
"watch": "encore dev --watch",
"build": "encore production --progress",
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"specs-build": "yaml-merge src/Bundle/ChillMainBundle/chill.api.specs.yaml src/Bundle/ChillPersonBundle/chill.api.specs.yaml src/Bundle/ChillCalendarBundle/chill.api.specs.yaml src/Bundle/ChillThirdPartyBundle/chill.api.specs.yaml src/Bundle/ChillDocStoreBundle/chill.api.specs.yaml> templates/api/specs.yaml",
"specs-validate": "swagger-cli validate templates/api/specs.yaml",
"specs-create-dir": "mkdir -p templates/api",

View File

@@ -1,18 +0,0 @@
// this file loads all assets from the Chill person bundle
module.exports = function (encore, entries) {
entries.push(__dirname + "/Resources/public/chill/index.js");
encore.addAliases({
ChillActivityAssets: __dirname + "/Resources/public",
});
encore.addEntry(
"page_edit_activity",
__dirname + "/Resources/public/page/edit_activity/index.scss",
);
encore.addEntry(
"vue_activity",
__dirname + "/Resources/public/vuejs/Activity/index.js",
);
};

View File

@@ -0,0 +1,14 @@
export default {
chillBase: [
"./src/Bundle/ChillActivityBundle/Resources/public/chill/index.js",
],
aliases: {
ChillActivityAssets: "./src/Bundle/ChillActivityBundle/Resources/public",
},
inputs: {
page_edit_activity:
"./src/Bundle/ChillActivityBundle/Resources/public/page/edit_activity/index.scss",
vue_activity:
"./src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/index.js",
},
};

View File

@@ -1,8 +0,0 @@
// this file loads all assets from the Chill budget bundle
module.exports = function (encore, entries) {
encore.addAliases({
ChillBudgetAssets: __dirname + "/Resources/public",
});
encore.addEntry("page_budget", __dirname + "/Resources/public/page/index.js");
};

View File

@@ -0,0 +1,8 @@
export default {
aliases: {
ChillBudgetAssets: "./src/Bundle/ChillBudgetBundle/Resources/public",
},
inputs: {
page_budget: "./src/Bundle/ChillBudgetBundle/Resources/public/page/index.js",
},
};

View File

@@ -1,25 +0,0 @@
// this file loads all assets from the Chill calendar bundle
module.exports = function (encore, entries) {
entries.push(__dirname + "/Resources/public/chill/chill.js");
encore.addAliases({
ChillCalendarAssets: __dirname + "/Resources/public",
});
encore.addEntry(
"vue_calendar",
__dirname + "/Resources/public/vuejs/Calendar/index.js",
);
encore.addEntry(
"vue_mycalendarrange",
__dirname + "/Resources/public/vuejs/MyCalendarRange/index2.ts",
);
encore.addEntry(
"page_calendar",
__dirname + "/Resources/public/chill/index.js",
);
encore.addEntry(
"mod_answer",
__dirname + "/Resources/public/module/Invite/answer.js",
);
};

View File

@@ -0,0 +1,18 @@
export default {
chillBase: [
"./src/Bundle/ChillCalendarBundle/Resources/public/chill/chill.js",
],
aliases: {
ChillCalendarAssets: "./src/Bundle/ChillCalendarBundle/Resources/public",
},
inputs: {
vue_calendar:
"./src/Bundle/ChillCalendarBundle/Resources/public/vuejs/Calendar/index.js",
vue_mycalendarrange:
"./src/Bundle/ChillCalendarBundle/Resources/public/vuejs/MyCalendarRange/index2.ts",
page_calendar:
"./src/Bundle/ChillCalendarBundle/Resources/public/chill/index.js",
mod_answer:
"./src/Bundle/ChillCalendarBundle/Resources/public/module/Invite/answer.js",
},
};

View File

@@ -1,11 +0,0 @@
// this file loads all assets from the Chill DocGenerator bundle
module.exports = function (encore, entries) {
encore.addAliases({
ChillDocGeneratorAssets: __dirname + "/Resources/public",
});
encore.addEntry(
"mod_docgen_picktemplate",
__dirname + "/Resources/public/module/PickTemplate/index.js",
);
};

View File

@@ -0,0 +1,10 @@
export default {
aliases: {
ChillDocGeneratorAssets:
"./src/Bundle/ChillDocGeneratorBundle/Resources/public",
},
inputs: {
mod_docgen_picktemplate:
"./src/Bundle/ChillDocGeneratorBundle/Resources/public/module/PickTemplate/index.js",
},
};

View File

@@ -1,21 +0,0 @@
module.exports = function (encore) {
encore.addAliases({
ChillDocStoreAssets: __dirname + "/Resources/public",
});
encore.addEntry(
"mod_async_upload",
__dirname + "/Resources/public/module/async_upload/index.ts",
);
encore.addEntry(
"mod_document_action_buttons_group",
__dirname + "/Resources/public/module/document_action_buttons_group/index",
);
encore.addEntry(
"mod_document_download_button",
__dirname + "/Resources/public/module/button_download/index",
);
encore.addEntry(
"vue_document_signature",
__dirname + "/Resources/public/vuejs/DocumentSignature/index",
);
};

View File

@@ -0,0 +1,15 @@
export default {
aliases: {
ChillDocStoreAssets: "./src/Bundle/ChillDocStoreBundle/Resources/public",
},
inputs: {
mod_async_upload:
"./src/Bundle/ChillDocStoreBundle/Resources/public/module/async_upload/index.ts",
mod_document_action_buttons_group:
"./src/Bundle/ChillDocStoreBundle/Resources/public/module/document_action_buttons_group/index",
mod_document_download_button:
"./src/Bundle/ChillDocStoreBundle/Resources/public/module/button_download/index",
vue_document_signature:
"./src/Bundle/ChillDocStoreBundle/Resources/public/vuejs/DocumentSignature/index",
},
};

View File

@@ -1,10 +0,0 @@
module.exports = function (encore, entries) {
entries.push(__dirname + "/Resources/public/chill/index.js");
encore.addEntry(
"vue_event",
__dirname + "/Resources/public/vuejs/index.js",
);
};

View File

@@ -0,0 +1,8 @@
export default {
chillBase: [
"./src/Bundle/ChillEventBundle/Resources/public/chill/index.js",
],
inputs: {
vue_event: "./src/Bundle/ChillEventBundle/Resources/public/vuejs/index.js",
},
};

View File

@@ -1,15 +0,0 @@
module.exports = function (encore, chillEntries) {
let dispositif_edit_file =
__dirname + "/Resources/public/module/dispositif_edit/index.js",
personal_situation_edit_file =
__dirname + "/Resources/public/module/personal_situation/index.js",
cv_edit_file = __dirname + "/Resources/public/module/cv_edit/index.js",
immersion_edit_file =
__dirname + "/Resources/public/module/immersion_edit/index.js",
images = __dirname + "/Resources/public/images/index.js";
encore.addEntry("dispositifs_edit", dispositif_edit_file);
encore.addEntry("personal_situation_edit", personal_situation_edit_file);
encore.addEntry("immersion_edit", immersion_edit_file);
encore.addEntry("images", images);
encore.addEntry("cs_cv", cv_edit_file);
};

View File

@@ -0,0 +1,13 @@
export default {
inputs: {
dispositifs_edit:
"./src/Bundle/ChillJobBundle/src/Resources/public/module/dispositif_edit/index.js",
personal_situation_edit:
"./src/Bundle/ChillJobBundle/src/Resources/public/module/personal_situation/index.js",
immersion_edit:
"./src/Bundle/ChillJobBundle/src/Resources/public/module/immersion_edit/index.js",
images: "./src/Bundle/ChillJobBundle/src/Resources/public/images/index.js",
cs_cv:
"./src/Bundle/ChillJobBundle/src/Resources/public/module/cv_edit/index.js",
},
};

View File

@@ -1,127 +0,0 @@
// Compile and loads all assets from the Chill Main Bundle
module.exports = function (encore, entries) {
// Push into "chill" entrypoint
entries.push(__dirname + "/Resources/public/chill/index.js");
// Aliases are used when webpack is trying to resolve modules path
encore.addAliases({
ChillMainAssets: __dirname + "/Resources/public",
ShowHide: __dirname + "/Resources/public/lib/show_hide",
Tabs: __dirname + "/Resources/public/lib/tabs",
});
// Page entrypoints
encore.addEntry(
"page_login",
__dirname + "/Resources/public/page/login/index.js",
);
encore.addEntry(
"page_location",
__dirname + "/Resources/public/page/location/index.js",
);
encore.addEntry(
"page_workflow_show",
__dirname + "/Resources/public/page/workflow-show/index.js",
);
encore.addEntry(
"page_homepage_widget",
__dirname + "/Resources/public/page/homepage_widget/index.js",
);
encore.addEntry(
"page_export",
__dirname + "/Resources/public/page/export/index.js",
);
encore.addEntry(
"page_download_exports",
__dirname + "/Resources/public/vuejs/DownloadExport/index.ts",
);
// Modules entrypoints
encore.addEntry(
"mod_collection",
__dirname + "/Resources/public/module/collection/index.ts",
);
encore.addEntry(
"mod_forkawesome",
__dirname + "/Resources/public/module/forkawesome/index.js",
);
encore.addEntry(
"mod_bootstrap",
__dirname + "/Resources/public/module/bootstrap/index.js",
);
encore.addEntry(
"mod_ckeditor5",
__dirname + "/Resources/public/module/ckeditor5/index",
);
encore.addEntry(
"mod_disablebuttons",
__dirname + "/Resources/public/module/disable-buttons/index.js",
);
encore.addEntry(
"mod_blur",
__dirname + "/Resources/public/module/blur/index.js",
);
encore.addEntry(
"mod_input_address",
__dirname + "/Resources/public/vuejs/Address/mod_input_address_index.js",
);
encore.addEntry(
"mod_notification_toggle_read_status",
__dirname + "/Resources/public/module/notification/toggle_read.js",
);
encore.addEntry(
"mod_notification_toggle_read_all_status",
__dirname + "/Resources/public/module/notification/toggle_read_all.ts",
);
encore.addEntry(
"mod_pickentity_type",
__dirname + "/Resources/public/module/pick-entity/index.js",
);
encore.addEntry(
"mod_entity_workflow_subscribe",
__dirname + "/Resources/public/module/entity-workflow-subscribe/index.js",
);
encore.addEntry(
"mod_entity_workflow_pick",
__dirname + "/Resources/public/module/entity-workflow-pick/index.js",
);
encore.addEntry(
"mod_pick_postal_code",
__dirname + "/Resources/public/module/pick-postal-code/index.js",
);
encore.addEntry(
"mod_pick_rolling_date",
__dirname + "/Resources/public/module/pick-rolling-date/index.js",
);
encore.addEntry(
"mod_address_details",
__dirname + "/Resources/public/module/address-details/index",
);
encore.addEntry(
"mod_news",
__dirname + "/Resources/public/module/news/index.js",
);
encore.addEntry(
"mod_workflow_attachment",
__dirname + "/Resources/public/vuejs/WorkflowAttachment/index",
);
encore.addEntry(
"mod_saved_export_button",
__dirname + "/Resources/public/vuejs/SavedExportButtons/index.ts",
);
// Vue entrypoints
encore.addEntry(
"vue_address",
__dirname + "/Resources/public/vuejs/Address/index.js",
);
encore.addEntry(
"vue_onthefly",
__dirname + "/Resources/public/vuejs/OnTheFly/index.js",
);
encore.addEntry(
"page_workflow_waiting_post_process",
__dirname + "/Resources/public/vuejs/WaitPostProcessWorkflow/index.ts"
);
};

View File

@@ -0,0 +1,64 @@
export default {
chillBase: [
"./src/Bundle/ChillMainBundle/Resources/public/chill/index.js",
],
aliases: {
ChillMainAssets: "./src/Bundle/ChillMainBundle/Resources/public",
ShowHide: "./src/Bundle/ChillMainBundle/Resources/public/lib/show_hide",
Tabs: "./src/Bundle/ChillMainBundle/Resources/public/lib/tabs",
},
inputs: {
page_login: "./src/Bundle/ChillMainBundle/Resources/public/page/login/index.js",
page_location:
"./src/Bundle/ChillMainBundle/Resources/public/page/location/index.js",
page_workflow_show:
"./src/Bundle/ChillMainBundle/Resources/public/page/workflow-show/index.js",
page_homepage_widget:
"./src/Bundle/ChillMainBundle/Resources/public/page/homepage_widget/index.js",
page_export:
"./src/Bundle/ChillMainBundle/Resources/public/page/export/index.js",
page_download_exports:
"./src/Bundle/ChillMainBundle/Resources/public/vuejs/DownloadExport/index.ts",
mod_collection:
"./src/Bundle/ChillMainBundle/Resources/public/module/collection/index.ts",
mod_forkawesome:
"./src/Bundle/ChillMainBundle/Resources/public/module/forkawesome/index.js",
mod_bootstrap:
"./src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/index.js",
mod_ckeditor5:
"./src/Bundle/ChillMainBundle/Resources/public/module/ckeditor5/index",
mod_disablebuttons:
"./src/Bundle/ChillMainBundle/Resources/public/module/disable-buttons/index.js",
mod_blur:
"./src/Bundle/ChillMainBundle/Resources/public/module/blur/index.js",
mod_input_address:
"./src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/mod_input_address_index.js",
mod_notification_toggle_read_status:
"./src/Bundle/ChillMainBundle/Resources/public/module/notification/toggle_read.js",
mod_notification_toggle_read_all_status:
"./src/Bundle/ChillMainBundle/Resources/public/module/notification/toggle_read_all.ts",
mod_pickentity_type:
"./src/Bundle/ChillMainBundle/Resources/public/module/pick-entity/index.js",
mod_entity_workflow_subscribe:
"./src/Bundle/ChillMainBundle/Resources/public/module/entity-workflow-subscribe/index.js",
mod_entity_workflow_pick:
"./src/Bundle/ChillMainBundle/Resources/public/module/entity-workflow-pick/index.js",
mod_pick_postal_code:
"./src/Bundle/ChillMainBundle/Resources/public/module/pick-postal-code/index.js",
mod_pick_rolling_date:
"./src/Bundle/ChillMainBundle/Resources/public/module/pick-rolling-date/index.js",
mod_address_details:
"./src/Bundle/ChillMainBundle/Resources/public/module/address-details/index",
mod_news: "./src/Bundle/ChillMainBundle/Resources/public/module/news/index.js",
mod_workflow_attachment:
"./src/Bundle/ChillMainBundle/Resources/public/vuejs/WorkflowAttachment/index",
mod_saved_export_button:
"./src/Bundle/ChillMainBundle/Resources/public/vuejs/SavedExportButtons/index.ts",
vue_address:
"./src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/index.js",
vue_onthefly:
"./src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/index.js",
page_workflow_waiting_post_process:
"./src/Bundle/ChillMainBundle/Resources/public/vuejs/WaitPostProcessWorkflow/index.ts",
},
};

View File

@@ -1,71 +0,0 @@
// this file loads all assets from the Chill person bundle
module.exports = function (encore, entries) {
entries.push(__dirname + "/Resources/public/chill/index.js");
// Aliases are used when webpack is trying to resolve modules path
encore.addAliases({
ChillPersonAssets: __dirname + "/Resources/public",
});
encore.addEntry(
"vue_household_members_editor",
__dirname + "/Resources/public/vuejs/HouseholdMembersEditor/index.js",
);
encore.addEntry(
"vue_accourse",
__dirname + "/Resources/public/vuejs/AccompanyingCourse/index.js",
);
encore.addEntry(
"vue_accourse_work_create",
__dirname + "/Resources/public/vuejs/AccompanyingCourseWorkCreate/index.js",
);
encore.addEntry(
"vue_accourse_work_edit",
__dirname + "/Resources/public/vuejs/AccompanyingCourseWorkEdit/index.js",
);
encore.addEntry(
"vue_visgraph",
__dirname + "/Resources/public/vuejs/VisGraph/index.js",
);
encore.addEntry(
"vue_export_action_goal_result",
__dirname + "/Resources/public/vuejs/ExportFormActionGoalResult/index.js",
);
encore.addEntry(
"mod_set_referrer",
__dirname + "/Resources/public/mod/AccompanyingPeriod/setReferrer.js",
);
encore.addEntry(
"page_household_edit_metadata",
__dirname + "/Resources/public/page/household_edit_metadata/index.js",
);
encore.addEntry(
"page_person",
__dirname + "/Resources/public/page/person/index.js",
);
encore.addEntry(
"page_accompanying_course_index_person_locate",
__dirname +
"/Resources/public/page/accompanying_course_index/person_locate.js",
);
encore.addEntry(
"page_accompanying_course_index_masonry",
__dirname + "/Resources/public/page/accompanying_course_index/masonry.js",
);
encore.addEntry(
"page_person_resource_showhide_input",
__dirname + "/Resources/public/page/person_resource/showhide-input.js",
);
encore.addEntry(
"page_suggest_names",
__dirname + "/Resources/public/page/person/suggest-names.js",
);
encore.addEntry(
"page_create_person",
__dirname + "/Resources/public/page/person/create-person.js",
);
encore.addEntry(
"mod_duplicate_selector",
__dirname + "/Resources/public/mod/DuplicateSelector/AccompanyingPeriodWorkSelector.ts",
);
};

View File

@@ -0,0 +1,40 @@
export default {
chillBase: [
"./src/Bundle/ChillPersonBundle/Resources/public/chill/index.js",
],
aliases: {
ChillPersonAssets: "./src/Bundle/ChillPersonBundle/Resources/public",
},
inputs: {
vue_household_members_editor:
"./src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/index.js",
vue_accourse:
"./src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/index.js",
vue_accourse_work_create:
"./src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/index.js",
vue_accourse_work_edit:
"./src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/index.js",
vue_visgraph:
"./src/Bundle/ChillPersonBundle/Resources/public/vuejs/VisGraph/index.js",
vue_export_action_goal_result:
"./src/Bundle/ChillPersonBundle/Resources/public/vuejs/ExportFormActionGoalResult/index.js",
mod_set_referrer:
"./src/Bundle/ChillPersonBundle/Resources/public/mod/AccompanyingPeriod/setReferrer.js",
page_household_edit_metadata:
"./src/Bundle/ChillPersonBundle/Resources/public/page/household_edit_metadata/index.js",
page_person:
"./src/Bundle/ChillPersonBundle/Resources/public/page/person/index.js",
page_accompanying_course_index_person_locate:
"./src/Bundle/ChillPersonBundle/Resources/public/page/accompanying_course_index/person_locate.js",
page_accompanying_course_index_masonry:
"./src/Bundle/ChillPersonBundle/Resources/public/page/accompanying_course_index/masonry.js",
page_person_resource_showhide_input:
"./src/Bundle/ChillPersonBundle/Resources/public/page/person_resource/showhide-input.js",
page_suggest_names:
"./src/Bundle/ChillPersonBundle/Resources/public/page/person/suggest-names.js",
page_create_person:
"./src/Bundle/ChillPersonBundle/Resources/public/page/person/create-person.js",
mod_duplicate_selector:
"./src/Bundle/ChillPersonBundle/Resources/public/mod/DuplicateSelector/AccompanyingPeriodWorkSelector.ts",
},
};

View File

@@ -1,8 +0,0 @@
module.exports = function (encore, entries) {
entries.push(__dirname + "/Resources/public/chill/index.js");
encore.addEntry(
"page_task_list",
__dirname + "/Resources/public/page/tile_list/index.js",
);
};

View File

@@ -0,0 +1,9 @@
export default {
chillBase: [
"./src/Bundle/ChillTaskBundle/Resources/public/chill/index.js",
],
inputs: {
page_task_list:
"./src/Bundle/ChillTaskBundle/Resources/public/page/tile_list/index.js",
},
};

View File

@@ -1,8 +0,0 @@
module.exports = function (encore, entries) {
// Aliases are used when webpack is trying to resolve modules path
encore.addAliases({
ChillThirdPartyAssets: __dirname + "/Resources/public",
});
entries.push(__dirname + "/Resources/public/chill/index.js");
};

View File

@@ -0,0 +1,10 @@
export default {
chillBase: [
"./src/Bundle/ChillThirdPartyBundle/Resources/public/chill/index.js",
],
aliases: {
ChillThirdPartyAssets:
"./src/Bundle/ChillThirdPartyBundle/Resources/public",
},
inputs: {},
};

View File

@@ -1,11 +0,0 @@
// this file loads all assets from the Chill person bundle
module.exports = function (encore, entries) {
encore.addEntry(
"page_wopi_editor",
__dirname + "/src/Resources/public/page/editor/index.ts",
);
encore.addEntry(
"mod_reload_page",
__dirname + "/src/Resources/public/module/pending/index",
);
};

View File

@@ -0,0 +1,8 @@
export default {
inputs: {
page_wopi_editor:
"./src/Bundle/ChillWopiBundle/src/Resources/public/page/editor/index.ts",
mod_reload_page:
"./src/Bundle/ChillWopiBundle/src/Resources/public/module/pending/index",
},
};

152
vite.config.js Normal file
View File

@@ -0,0 +1,152 @@
import { defineConfig } from "vite";
import symfonyPlugin from "vite-plugin-symfony";
import vue from "@vitejs/plugin-vue";
import { resolve } from "path";
import { writeFile, mkdir } from "fs/promises";
import { existsSync } from "fs";
// --- Vite configuration aggregated from per-bundle vite.config.js files ---
// Import per-bundle lightweight config objects that replace former chill.webpack.config.js
import ChillMain from "./src/Bundle/ChillMainBundle/vite.config.js";
import ChillPerson from "./src/Bundle/ChillPersonBundle/vite.config.js";
import ChillActivity from "./src/Bundle/ChillActivityBundle/vite.config.js";
import ChillBudget from "./src/Bundle/ChillBudgetBundle/vite.config.js";
import ChillCalendar from "./src/Bundle/ChillCalendarBundle/vite.config.js";
import ChillDocGenerator from "./src/Bundle/ChillDocGeneratorBundle/vite.config.js";
import ChillDocStore from "./src/Bundle/ChillDocStoreBundle/vite.config.js";
import ChillEvent from "./src/Bundle/ChillEventBundle/vite.config.js";
import ChillTask from "./src/Bundle/ChillTaskBundle/vite.config.js";
import ChillThirdParty from "./src/Bundle/ChillThirdPartyBundle/vite.config.js";
import ChillWopi from "./src/Bundle/ChillWopiBundle/vite.config.js";
import ChillJob from "./src/Bundle/ChillJobBundle/src/vite.config.js";
async function ensureChillAggregatedEntry(chillEntries) {
// Generate a small aggregate file that imports all base chill entry files
const outDir = "./assets";
if (!existsSync(outDir)) {
await mkdir(outDir, { recursive: true });
}
const outFile = resolve(outDir, "chill.entry.js");
const unique = Array.from(new Set(chillEntries));
const content = unique
.map((p, i) => `// auto-generated import ${i}\nimport "${p.replace(/\\/g, "/")}";`)
.join("\n");
await writeFile(outFile, `${content}\n`);
return outFile;
}
export default defineConfig(async () => {
// Merge per-bundle small configs
const bundleConfigs = [
ChillMain,
ChillPerson,
ChillActivity,
ChillBudget,
ChillCalendar,
ChillDocGenerator,
ChillDocStore,
ChillEvent,
ChillTask,
ChillThirdParty,
ChillWopi,
ChillJob,
];
// Aggregate chill base imports
const chillBases = bundleConfigs.flatMap((c) => c.chillBase ?? []);
const chillEntryPath = await ensureChillAggregatedEntry(
chillBases.map((p) => resolve(__dirname, p))
);
// Merge inputs
const inputs = Object.assign(
{},
// Legacy root app entry if present
existsSync(resolve("./assets/app.js")) ? { app: "./assets/app.js" } : {},
existsSync(resolve("./assets/app.ts")) ? { app: "./assets/app.ts" } : {},
// Per bundle inputs
...bundleConfigs.map((c) => c.inputs || {})
);
// Add the aggregated chill shared entry
inputs.chill = chillEntryPath;
// Merge aliases (root level + bundle level) and normalize to absolute paths
const mergedAliasObj = Object.assign(
{
translator: resolve(__dirname, "./assets/translator"),
"@symfony/ux-translator": resolve(
__dirname,
"./vendor/symfony/ux-translator/assets"
),
},
...bundleConfigs.map((c) => c.aliases || {})
);
// Vite/Rollup alias replacements work best with absolute paths. Convert any
// string replacements to absolute paths rooted at this config file.
const aliasObj = Object.fromEntries(
Object.entries(mergedAliasObj).map(([key, val]) => {
if (typeof val === "string") {
// If already absolute (starts with "/" or a drive letter pattern), keep it.
const isAbsolute = val.startsWith("/") || /^[A-Za-z]:\\/.test(val);
return [key, isAbsolute ? val : resolve(__dirname, val)];
}
return [key, val];
})
);
// Support legacy Sass/Webpack tilde imports like `~Alias/...` by adding
// a tilded alias that points to the same location for every alias key.
for (const key of Object.keys(aliasObj)) {
if (!key.startsWith("~")) {
const tildeKey = `~${key}`;
if (!aliasObj[tildeKey]) {
aliasObj[tildeKey] = aliasObj[key];
}
}
}
return {
plugins: [
vue(),
symfonyPlugin(),
],
resolve: {
alias: aliasObj,
// Allow imports without extension for Vue and TS like `.../App` or `.../Modal`
extensions: [
".mjs",
".js",
".ts",
".jsx",
".tsx",
".json",
".vue",
],
},
css: {
// Forward options to sass/scss compiler to quiet dependency warnings
preprocessorOptions: {
scss: {
quietDeps: true,
silenceDeprecations: ["import"],
},
sass: {
quietDeps: true,
silenceDeprecations: ["import"],
},
},
},
server: {
// ViteBundle reads Symfony env to configure devServer proxy automatically.
// Keep defaults; expose HMR host for Docker if needed later.
strictPort: false,
},
build: {
sourcemap: process.env.NODE_ENV !== "production",
rollupOptions: {
input: inputs,
},
},
};
});