Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/Dashboard/CasesOverviewWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ public function getUrl(): ?string
*/
public function load(): void
{
// Shared vendor chunks emitted by webpack splitChunks (see webpack.config.js).
Util::addScript(Application::APP_ID, Application::APP_ID.'-shared-vendor');
Util::addScript(Application::APP_ID, Application::APP_ID.'-shared-nc-vue');
Util::addScript(Application::APP_ID, Application::APP_ID.'-casesOverviewWidget');
Util::addStyle(Application::APP_ID, 'dashboardWidgets');

Expand Down
3 changes: 3 additions & 0 deletions lib/Dashboard/DeadlineAlertsWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ public function getUrl(): ?string
*/
public function load(): void
{
// Shared vendor chunks emitted by webpack splitChunks (see webpack.config.js).
Util::addScript(Application::APP_ID, Application::APP_ID.'-shared-vendor');
Util::addScript(Application::APP_ID, Application::APP_ID.'-shared-nc-vue');
Util::addScript(Application::APP_ID, Application::APP_ID.'-deadlineAlertsWidget');
Util::addStyle(Application::APP_ID, 'dashboardWidgets');

Expand Down
3 changes: 3 additions & 0 deletions lib/Dashboard/MyTasksWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ public function getUrl(): ?string
*/
public function load(): void
{
// Shared vendor chunks emitted by webpack splitChunks (see webpack.config.js).
Util::addScript(Application::APP_ID, Application::APP_ID.'-shared-vendor');
Util::addScript(Application::APP_ID, Application::APP_ID.'-shared-nc-vue');
Util::addScript(Application::APP_ID, Application::APP_ID.'-myTasksWidget');
Util::addStyle(Application::APP_ID, 'dashboardWidgets');

Expand Down
3 changes: 3 additions & 0 deletions lib/Dashboard/OverdueCasesWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ public function getUrl(): ?string
*/
public function load(): void
{
// Shared vendor chunks emitted by webpack splitChunks (see webpack.config.js).
Util::addScript(Application::APP_ID, Application::APP_ID.'-shared-vendor');
Util::addScript(Application::APP_ID, Application::APP_ID.'-shared-nc-vue');
Util::addScript(Application::APP_ID, Application::APP_ID.'-overdueCasesWidget');
Util::addStyle(Application::APP_ID, 'dashboardWidgets');

Expand Down
3 changes: 3 additions & 0 deletions lib/Dashboard/StalledCasesWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ public function getUrl(): ?string
*/
public function load(): void
{
// Shared vendor chunks emitted by webpack splitChunks (see webpack.config.js).
Util::addScript(Application::APP_ID, Application::APP_ID.'-shared-vendor');
Util::addScript(Application::APP_ID, Application::APP_ID.'-shared-nc-vue');
Util::addScript(Application::APP_ID, Application::APP_ID.'-stalledCasesWidget');
Util::addStyle(Application::APP_ID, 'dashboardWidgets');

Expand Down
3 changes: 3 additions & 0 deletions lib/Dashboard/StartCaseWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ public function getUrl(): ?string
*/
public function load(): void
{
// Shared vendor chunks emitted by webpack splitChunks (see webpack.config.js).
Util::addScript(Application::APP_ID, Application::APP_ID.'-shared-vendor');
Util::addScript(Application::APP_ID, Application::APP_ID.'-shared-nc-vue');
Util::addScript(Application::APP_ID, Application::APP_ID.'-startCaseWidget');
Util::addStyle(Application::APP_ID, 'dashboardWidgets');
}//end load()
Expand Down
3 changes: 3 additions & 0 deletions lib/Dashboard/TaskRemindersWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ public function getUrl(): ?string
*/
public function load(): void
{
// Shared vendor chunks emitted by webpack splitChunks (see webpack.config.js).
Util::addScript(Application::APP_ID, Application::APP_ID.'-shared-vendor');
Util::addScript(Application::APP_ID, Application::APP_ID.'-shared-nc-vue');
Util::addScript(Application::APP_ID, Application::APP_ID.'-taskRemindersWidget');
Util::addStyle(Application::APP_ID, 'dashboardWidgets');

Expand Down
37 changes: 37 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,41 @@ webpackConfig.plugins = [
// preventing the nextcloud-vue submodule's nested deps (Vue 3) from leaking in.
webpackConfig.resolve.alias['@nextcloud/dialogs'] = path.resolve(__dirname, 'node_modules/@nextcloud/dialogs')

// Share Vue + @nextcloud/vue + pinia + icons + @conduction/nextcloud-vue
// across every entry-point so each widget bundle no longer inlines its own
// ~5 MB framework copy. Stable filenames (no contenthash in the JS name)
// mean each widget's `Util::addScript` PHP call can reference the chunk
// directly without a manifest. The vendor chunk is loaded once and cached
// across every widget/page in the app.
webpackConfig.optimization = {
...(webpackConfig.optimization || {}),
splitChunks: {
...(webpackConfig.optimization?.splitChunks || {}),
chunks: 'all',
cacheGroups: {
default: false,
defaultVendors: false,
ncVue: {
name: appId + '-shared-nc-vue',
// Matches both node_modules entries AND the monorepo-dev alias
// `../nextcloud-vue/src/...` which webpack resolves outside
// node_modules when @conduction/nextcloud-vue is aliased to it.
test: /[\\/]node_modules[\\/](@nextcloud[\\/]vue|@conduction[\\/]nextcloud-vue)[\\/]|[\\/]nextcloud-vue[\\/]src[\\/]/,
priority: 30,
reuseExistingChunk: true,
enforce: true,
filename: appId + '-shared-nc-vue.js',
},
vendor: {
name: appId + '-shared-vendor',
test: /[\\/]node_modules[\\/](vue|pinia|vue-material-design-icons|@vueuse|core-js)[\\/]/,
priority: 20,
reuseExistingChunk: true,
enforce: true,
filename: appId + '-shared-vendor.js',
},
},
},
}

module.exports = webpackConfig
Loading