diff --git a/core/core.services.yml b/core/core.services.yml
index c5a13a4..5d04eed 100644
--- a/core/core.services.yml
+++ b/core/core.services.yml
@@ -1474,7 +1474,7 @@ services:
       - { name: needs_destruction }
   library.discovery.parser:
     class: Drupal\Core\Asset\LibraryDiscoveryParser
-    arguments: ['@app.root', '@module_handler', '@theme.manager']
+    arguments: ['@app.root', '@module_handler', '@theme.manager', '@info_parser']
   library.dependency_resolver:
     class: Drupal\Core\Asset\LibraryDependencyResolver
     arguments: ['@library.discovery']
diff --git a/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php b/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php
index f25b7b0..0ae6647 100644
--- a/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php
+++ b/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php
@@ -11,6 +11,7 @@
 use Drupal\Core\Asset\Exception\InvalidLibrariesOverrideSpecificationException;
 use Drupal\Core\Asset\Exception\InvalidLibraryFileException;
 use Drupal\Core\Asset\Exception\LibraryDefinitionMissingLicenseException;
+use Drupal\Core\Extension\InfoParserInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Theme\ThemeManagerInterface;
 use Drupal\Component\Serialization\Exception\InvalidDataTypeException;
@@ -37,6 +38,13 @@ class LibraryDiscoveryParser {
   protected $themeManager;
 
   /**
+   * The info parser.
+   *
+   * @var \Drupal\Core\Extension\InfoParserInterface
+   */
+  protected $infoParser;
+
+  /**
    * The app root.
    *
    * @var string
@@ -52,11 +60,14 @@ class LibraryDiscoveryParser {
    *   The module handler.
    * @param \Drupal\Core\Theme\ThemeManagerInterface $theme_manager
    *   The theme manager.
+   * @param \Drupal\Core\Extension\InfoParserInterface $info_parser
+   *   The info parser.
    */
-  public function __construct($root, ModuleHandlerInterface $module_handler, ThemeManagerInterface $theme_manager) {
+  public function __construct($root, ModuleHandlerInterface $module_handler, ThemeManagerInterface $theme_manager, InfoParserInterface $info_parser) {
     $this->root = $root;
     $this->moduleHandler = $module_handler;
     $this->themeManager = $theme_manager;
+    $this->infoParser = $info_parser;
   }
 
   /**
@@ -104,9 +115,18 @@ public function buildByExtension($extension) {
       }
 
       if (isset($library['version'])) {
-        // @todo Retrieve version of a non-core extension.
         if ($library['version'] === 'VERSION') {
-          $library['version'] = \Drupal::VERSION;
+          if ($extension_type === 'core' || strpos($path, 'core/modules/') === 0) {
+            $library['version'] = \Drupal::VERSION;
+          }
+          elseif ($extension_type === 'module') {
+            $info = $this->infoParser->parse($this->moduleHandler->getModule($extension)->getPathname());
+            $library['version'] = !empty($info['version']) ? $info['version'] : \Drupal::VERSION;
+          }
+          elseif ($extension_type === 'theme') {
+            $info = $this->infoParser->parse($this->themeManager->getActiveTheme()->getExtension()->getPathname());
+            $library['version'] = !empty($info['version']) ? $info['version'] : \Drupal::VERSION;
+          }
         }
         // Remove 'v' prefix from external library versions.
         elseif ($library['version'][0] === 'v') {
