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
12 changes: 12 additions & 0 deletions templates/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
use OCP\Util;

$appId = OCA\AppTemplate\AppInfo\Application::APP_ID;

// webpack splitChunks (see webpack.config.js) emits two shared chunks
// (`shared-vendor`, `shared-nc-vue`) via `enforce: true` cacheGroups. The
// main entry's bundle tail wraps the Vue mount in
// `__webpack_require__.O(0, [shared chunks], …)` which only fires once every
// listed chunk has registered itself on `self.webpackChunk<appId>`. If we
// only `addScript` the main entry, the shared chunks never load, the
// callback never fires, and the Vue app silently fails to mount inside the
// `#content` wrapper. Register every chunk produced by splitChunks here,
// in dependency order, before the main entry. (Mirrors zaakafhandelapp#206.)
Util::addScript($appId, $appId . '-shared-vendor');
Util::addScript($appId, $appId . '-shared-nc-vue');
Util::addScript($appId, $appId . '-main');
?>
<div id="content"></div>
7 changes: 7 additions & 0 deletions templates/settings/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
use OCP\Util;

$appId = OCA\AppTemplate\AppInfo\Application::APP_ID;

// webpack splitChunks emits shared chunks that every entry-point depends on
// (see comment in templates/index.php). The admin-settings entry's bundle
// tail also wraps its mount in `__webpack_require__.O(...)` waiting for the
// shared chunks, so register them in dependency order here too.
Util::addScript($appId, $appId . '-shared-vendor');
Util::addScript($appId, $appId . '-shared-nc-vue');
Util::addScript($appId, $appId . '-settings');
?>
<div id="app-template-settings" data-version="<?php p($_['version'] ?? ''); ?>"></div>
Loading