| @@ -114,8 +114,25 @@ | ||
| 114 | 114 | |
| 115 | 115 | return false; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | + /** | |
| 119 | + * Build the URL an entry script is loaded with from HTML. | |
| 120 | + * | |
| 121 | + * The build rewrites every inter-chunk import to `<chunk>.js?ver=<version>` | |
| 122 | + * (see src/dev/version-plugin.js), and wp_enqueue_script() emits the same | |
| 123 | + * `?ver=` key. HTML script tags must match it exactly: to the browser | |
| 124 | + * `app.js?version=x` and `app.js?ver=x` are two different modules, so a | |
| 125 | + * mismatch evaluates the whole app a second time and remounts it. | |
| 126 | + * | |
| 127 | + * @param string $url | |
| 128 | + * @return string | |
| 129 | + */ | |
| 130 | + public static function versionedUrl($url) | |
| 131 | + { | |
| 132 | + return $url . '?ver=' . FLUENT_COMMUNITY_PLUGIN_VERSION; | |
| 133 | + } | |
| 134 | + | |
| 118 | 135 | public static function getAssetsUrl() |
| 119 | 136 | { |
| 120 | 137 | if (!self::isDev()) { |
| 121 | 138 | return static::$assetsURL; |