diff --git a/README.md b/README.md index 7f76ac7b146ce941a539e7ebdfcf5b05218e6388..b446b7dd3f05444bbd4d944fcecdad07a76a8c9d 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ The Vue.js Drupal module provides a bridge between Drupal and the Vue.js framewo 3. Update the vuejs module via composer: `composer update 'drupal/vuejs'` 4. Navigate to the `admin/config/development/vue` page. 5. Set the installation type to "Local library". -6. Set the library path to `/package/dist/vue.runtime.global.prod.js` if not already defined so. +6. Set the library path to `/package/dist/vue.global.prod.js` if not already defined so. ### Library installation via manual download @@ -31,7 +31,7 @@ The Vue.js Drupal module provides a bridge between Drupal and the Vue.js framewo 2. Extract the tar inside the drupal `libraries/vue` folder. 3. Navigate to the `admin/config/development/vuejs` page. 4. Set the installation type to "Local library". -5. Set the library path to `/libraries/vue/package/dist/vue.runtime.global.prod.js` if not already defined so. +5. Set the library path to `/libraries/vue/package/dist/vue.global.prod.js` if not already defined so. #### Vue 2 1. Download `https://registry.npmjs.org/vue/-/vue-2.7.16.tgz` diff --git a/config/install/vuejs.settings.yml b/config/install/vuejs.settings.yml index 88fcd8aa8755f850bcefdf452582371ac5b6950f..96c89bfb67a78e541130ebeea949597103b01a7f 100644 --- a/config/install/vuejs.settings.yml +++ b/config/install/vuejs.settings.yml @@ -1,7 +1,7 @@ vue: enabled: true installation: cdn - path: //unpkg.com/vue@3.5.13/dist/vue.runtime.global.prod.js + path: //unpkg.com/vue@3.5.13/dist/vue.global.prod.js cdn_provider: unpkg cdn_version: 3.5.13 petitevue: diff --git a/src/Form/SettingsForm.php b/src/Form/SettingsForm.php index f3e7de487c810456b65a5b654376ec61815c67ea..b499d6968087fa5aebd58ae1d7e76e813c15bd7a 100644 --- a/src/Form/SettingsForm.php +++ b/src/Form/SettingsForm.php @@ -97,7 +97,7 @@ final class SettingsForm extends ConfigFormBase { '#title' => $this->t('Library path'), '#default_value' => $vueSettings['path'], '#attributes' => [ - 'placeholder' => '/libraries/vue/package/dist/vue.runtime.global.prod.js', + 'placeholder' => '/libraries/vue/package/dist/vue.global.prod.js', ], '#description' => $this->t('The path to the library file. See <a href=:link>here</a> for more infos on how to setup the vue library locally. Leave empty to disable the library.', [':link' => Url::fromRoute('help.page', ['name' => 'vuejs'])->toString()]), '#states' => [ @@ -255,7 +255,7 @@ final class SettingsForm extends ConfigFormBase { if ($vueFormValues['installation'] === 'cdn' && (bool) $enableVueLibrary) { // The file name differs from Vue 2 to Vue 3, so we need to do a version // compare here: - $fileName = version_compare($vueFormValues['cdn_version'], '3.0.0', '>=') ? 'vue.runtime.global.prod.js' : 'vue.global.prod.js'; + $fileName = version_compare($vueFormValues['cdn_version'], '3.0.0', '>=') ? 'vue.global.prod.js' : 'vue.min.js'; switch ($vueFormValues['cdn_provider']) { case 'jsdelivr': $vueFormValues['path'] = '//cdn.jsdelivr.net/npm/vue@' . $vueFormValues['cdn_version'] . '/dist/' . $fileName; diff --git a/vuejs.install b/vuejs.install index 8354b8acdbfc4301cb34f8ab0a80e65729ea537e..3c7f63c59287db6919c9e4ae351c5e5b46c43f02 100644 --- a/vuejs.install +++ b/vuejs.install @@ -137,3 +137,24 @@ function vuejs_update_93003(&$sandbox) { // Clear library discovery cache, so the new settings are picked up: \Drupal::service('library.discovery')->clearCachedDefinitions(); } + +/** + * Fixes regression. + * + * Introduced in https://www.drupal.org/project/vuejs/issues/3488596. + */ +function vuejs_update_93004(&$sandbox) { + $config_factory = \Drupal::configFactory(); + $config = $config_factory->getEditable('vuejs.settings'); + + // Set the vue config: + $vueConfig = $config->get('vue'); + $vuePath = $vueConfig['path']; + + if (str_contains($vuePath, 'vue.runtime.global.prod.js')) { + $vuePath = str_replace('vue.runtime.global.prod.js', 'vue.global.prod.js', $vuePath); + } + elseif (str_contains($vuePath, 'vue.global.prod.js') && version_compare($vueConfig['cdn_version'], '3.0.0', '<')) { + $vuePath = str_replace('vue.global.prod.js', 'vue.min.js', $vuePath); + } +}