diff --git a/conditional_fields.api.php b/conditional_fields.api.php
index d937047..07b1068 100644
--- a/conditional_fields.api.php
+++ b/conditional_fields.api.php
@@ -193,3 +193,29 @@ function conditional_fields_example_fancy_view_behavior($dependee, $dependent, $
     $build['#prefix'] .= 'foo';
   }
 }
+
+/**
+ * Alter the dependee before dumping it as a code.
+ *
+ * @param array $dependee
+ *   A dependee to process.
+ * @param string $module_name
+ *   The name of module providing the data.
+ *
+ * @see conditional_fields_features_export_render()
+ */
+function hook_conditional_fields_features_export_render_alter(array &$dependee, $module_name) {
+}
+
+/**
+ * Alter the dependee before adding it to a database.
+ *
+ * @param array $dependee
+ *   A dependee to process.
+ * @param string $module_name
+ *   The name of module providing the data.
+ *
+ * @see conditional_fields_features_rebuild()
+ */
+function hook_conditional_fields_features_rebuild_alter(array &$dependee, $module_name) {
+}
diff --git a/includes/conditional_fields.features.inc b/conditional_fields.features.inc
similarity index 50%
rename from includes/conditional_fields.features.inc
rename to conditional_fields.features.inc
index 24c2885..28745e3 100644
--- a/includes/conditional_fields.features.inc
+++ b/conditional_fields.features.inc
@@ -1,7 +1,8 @@
 <?php
+
 /**
  * @file
- * Features integration hooks.
+ * Features integration.
  */
 
 /**
@@ -59,13 +60,16 @@ function conditional_fields_features_export_render($module_name, $data, $export
       $code[] = '  $items["' . $option . '"] = array(';
       foreach ($info['dependents'] as $dependent_field_name => $dependees) {
         foreach ($dependees as $dependee) {
-          $code[] = "    array(";
-          $code[] = "      'entity' => '" . $entity . "',";
-          $code[] = "      'bundle' => '" . $bundle . "',";
-          $code[] = "      'dependent' => '" . $dependent_field_name . "',";
-          $code[] = "      'dependee' => '" . $dependee['dependee'] . "',";
-          $code[] = "      'options' => " . features_var_export($dependee['options'], '      ') . ',';
-          $code[] = '    ),';
+          $dependee = array(
+            'entity' => $entity,
+            'bundle' => $bundle,
+            'dependent' => $dependent_field_name,
+          ) + $dependee;
+
+          /* @see hook_conditional_fields_features_export_render_alter() */
+          drupal_alter(__FUNCTION__, $dependee, $module_name);
+
+          $code[] = '    ' . features_var_export($dependee, '    ') . ',';
         }
       }
 
@@ -94,7 +98,10 @@ function conditional_fields_features_rebuild($module) {
     $dependencies = conditional_fields_load_dependencies();
     $instances = field_info_instances();
     foreach ($defaults as $item) {
-      foreach($item as $field) {
+      foreach ($item as $field) {
+        /* @see hook_conditional_fields_features_rebuild_alter() */
+        drupal_alter(__FUNCTION__, $field, $module);
+
         if (isset($dependencies[$field['entity']][$field['bundle']])) {
           foreach ($dependencies[$field['entity']][$field['bundle']] as $dependancy_type => $field_dep_settings) {
             if ($dependancy_type == 'dependees' && !empty($field_dep_settings)) {
@@ -122,5 +129,86 @@ function conditional_fields_features_rebuild($module) {
  * Implements hook_features_revert().
  */
 function conditional_fields_features_revert($module) {
-  return conditional_fields_features_rebuild($module);
+  conditional_fields_features_rebuild($module);
+}
+
+/**
+ * Implements hook_conditional_fields_features_export_render_alter().
+ *
+ * @internal
+ */
+function conditional_fields_conditional_fields_features_export_render_alter(array &$dependee, $module_name) {
+  conditional_fields_features_entity_reference_process($dependee, 'entity_get_uuid_by_id');
+}
+
+/**
+ * Implements hook_conditional_fields_features_rebuild_alter().
+ *
+ * @internal
+ */
+function conditional_fields_conditional_fields_features_rebuild_alter(array &$dependee, $module_name) {
+  conditional_fields_features_entity_reference_process($dependee, 'entity_get_id_by_uuid');
+}
+
+/**
+ * Allows exporting UUIDs of referenced entities instead of their IDs.
+ *
+ * @param array $dependee
+ *   A dependee to process.
+ * @param string $exchanger
+ *   A callback function to swap ID with UUID and vice versa.
+ *
+ * @internal
+ */
+function conditional_fields_features_entity_reference_process(array &$dependee, $exchanger) {
+  static $field_info = array();
+
+  if (function_exists($exchanger)) {
+    $field_parents_callback = function ($i) {
+      return array('value', $i, 'target_id');
+    };
+
+    // Check for the entity reference field by specific parents.
+    if (NULL !== drupal_array_get_nested_value($dependee['options'], $field_parents_callback(0))) {
+      if (!isset($field_info[$dependee['dependee']])) {
+        $field_info[$dependee['dependee']] = field_info_field($dependee['dependee']);
+      }
+
+      // Distinguish the type of widget by the parents in "value_form".
+      foreach (array(
+        // Hierarchical select widget.
+        function ($i) {
+          return array('value_form', 'hierarchical_select', 'selects', $i);
+        },
+        // Default widgets.
+        function ($i) {
+          return array('value_form', $i, 'target_id');
+        },
+      ) as $widget_parents_callback) {
+        if (NULL !== drupal_array_get_nested_value($dependee['options'], $widget_parents_callback(0))) {
+          $ids_list = array();
+
+          foreach ($dependee['options']['value'] as $i => $option) {
+            $ids_list[$i] = $option['target_id'];
+          }
+
+          $ids = $exchanger($field_info[$dependee['dependee']]['settings']['target_type'], $ids_list);
+
+          // Need to iterate over the initial list to preserve ordering of
+          // values.
+          foreach ($ids_list as $i => $id) {
+            if (isset($ids[$id])) {
+              // Set value for the field and its form.
+              foreach (array($field_parents_callback($i), $widget_parents_callback($i)) as $parents) {
+                drupal_array_set_nested_value($dependee['options'], $parents, $ids[$id]);
+              }
+            }
+          }
+
+          // A single field cannot have more than one widget so stop here.
+          break;
+        }
+      }
+    }
+  }
 }
diff --git a/conditional_fields.info b/conditional_fields.info
index a4ccce8..2588580 100644
--- a/conditional_fields.info
+++ b/conditional_fields.info
@@ -3,6 +3,12 @@ description = Define dependencies between fields based on their states and value
 core = 7.x
 package = Fields
 
+configure = admin/structure/dependencies
+
+test_dependencies[] = uuid
+test_dependencies[] = features
+test_dependencies[] = entityreference
+test_dependencies[] = hierarchical_select
+
 dependencies[] = system (>=7.14)
 dependencies[] = field
-configure = admin/structure/dependencies
diff --git a/conditional_fields.module b/conditional_fields.module
index 5b50edd..4c82a47 100644
--- a/conditional_fields.module
+++ b/conditional_fields.module
@@ -95,6 +95,23 @@ function conditional_fields_permission() {
   );
 }
 
+/**
+ * Implements hook_hook_info().
+ */
+function conditional_fields_hook_info() {
+  $info = array();
+
+  $info['conditional_fields_features_export_render_alter'] = array(
+    'group' => 'features',
+  );
+
+  $info['conditional_fields_features_rebuild_alter'] = array(
+    'group' => 'features',
+  );
+
+  return $info;
+}
+
 /**
  * Implements hook_menu().
  */
@@ -2023,7 +2040,7 @@ function conditional_fields_features_api() {
       'default_hook' => 'conditional_fields_default_fields',
       'default_file' => FEATURES_DEFAULTS_INCLUDED,
       'feature_source' => TRUE,
-      'file' => drupal_get_path('module', 'conditional_fields') . '/includes/conditional_fields.features.inc',
+      'file' => drupal_get_path('module', 'conditional_fields') . '/conditional_fields.features.inc',
     ),
   );
 }
diff --git a/src/Tests/EntityReferenceFeaturesUuidExportImport/AutocompleteWidgetTest.php b/src/Tests/EntityReferenceFeaturesUuidExportImport/AutocompleteWidgetTest.php
new file mode 100644
index 0000000..838b55f
--- /dev/null
+++ b/src/Tests/EntityReferenceFeaturesUuidExportImport/AutocompleteWidgetTest.php
@@ -0,0 +1,370 @@
+<?php
+
+namespace Drupal\conditional_fields\Tests\EntityReferenceFeaturesUuidExportImport;
+
+/**
+ * Class AutocompleteWidgetTest.
+ */
+class AutocompleteWidgetTest extends \DrupalWebTestCase {
+
+  /**
+   * The type of entity to test on.
+   *
+   * Overriding of this constant will not affect anything since
+   * we're not supporting any other entity types in tests.
+   */
+  const ENTITY_TYPE = 'node';
+
+  /**
+   * The list of modules to enable before the test.
+   *
+   * @var string[]
+   */
+  protected $modules = array();
+  /**
+   * An associative array of instances of fields.
+   *
+   * @var array[]
+   */
+  protected $fieldInstances = array();
+  /**
+   * Content type.
+   *
+   * @var \stdClass
+   */
+  protected $contentType;
+  /**
+   * Taxonomy vocabulary.
+   *
+   * @var \stdClass
+   */
+  protected $vocabulary;
+  /**
+   * Taxonomy term.
+   *
+   * @var \stdClass
+   */
+  protected $term;
+  /**
+   * User to create the feature.
+   *
+   * @var \stdClass
+   */
+  protected $user;
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function getInfo() {
+    $namespace = explode('\\', get_called_class());
+
+    return array(
+      // The last part is the name of a class. It will be the name of the test.
+      'name' => end($namespace),
+      // The first part (zero index) is "Drupal", second - name of
+      // the module. Use it as an identifier of the group.
+      'group' => $namespace[1],
+    );
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUp() {
+    parent::setUp(array_merge($this->modules, array(
+      'taxonomy',
+      'conditional_fields',
+      'entityreference',
+      'features',
+      'uuid',
+    )));
+
+    $this->contentType = $this->drupalCreateContentType(array(
+      'type' => 'test_content_type',
+    ));
+
+    $this->vocabulary = $this->drupalCreateTaxonomyVocabulary(array(
+      'machine_name' => 'test_vocabulary',
+    ));
+
+    $this->user = $this->drupalCreateUser(array(
+      'administer dependencies',
+      'administer features',
+      'generate features',
+    ));
+
+    $this->term = $this->drupalCreateTaxonomyTerm($this->vocabulary);
+
+    foreach (array(
+      'field_text' => array(
+        'type' => 'text',
+        'settings' => array(
+          'max_length' => 60,
+        ),
+      ),
+      'field_reference' => array(
+        'type' => 'entityreference',
+        'widget' => $this->getWidget(),
+        'settings' => array(
+          'handler' => 'base',
+          'target_type' => 'taxonomy_term',
+          'handler_settings' => array(
+            'target_bundles' => array($this->vocabulary->machine_name),
+          ),
+        ),
+      ),
+    ) as $field_name => $info) {
+      $info += array(
+        'bundle' => $this->contentType->type,
+        'field_name' => $field_name,
+        'entity_type' => self::ENTITY_TYPE,
+        'entity_types' => array(self::ENTITY_TYPE),
+      );
+
+      field_create_field($info);
+      field_create_instance($info);
+
+      $this->fieldInstances[$field_name] = field_info_instance(
+        self::ENTITY_TYPE,
+        $field_name,
+        $this->contentType->type
+      );
+    }
+  }
+
+  /**
+   * Returns definition of the field widget to test export of.
+   *
+   * @return array
+   *   Definition of the widget.
+   */
+  protected function getWidget() {
+    return array(
+      'type' => 'entityreference_autocomplete',
+      'active' => TRUE,
+      'module' => 'entityreference',
+      'settings' => array(
+        'match_operator' => 'CONTAINS',
+        'size' => 60,
+        'path' => '',
+      ),
+    );
+  }
+
+  /**
+   * Returns the value for the field for the particular widget.
+   *
+   * @param null|string $value
+   *   A value to use instead of the default.
+   *
+   * @return array[]
+   *   Value for the field.
+   */
+  protected function getWidgetValue($value = NULL) {
+    if (NULL === $value) {
+      $value = $this->term->name . ' (' . $this->term->tid . ')';
+    }
+
+    return array(array('target_id' => $value));
+  }
+
+  /**
+   * Returns the value for the form of the field for the particular widget.
+   *
+   * @param null|string $value
+   *   A value to use instead of the default.
+   *
+   * @return array[]
+   *   Value for the form of the field.
+   */
+  protected function getWidgetValueForm($value = NULL) {
+    return $this->getWidgetValue($value);
+  }
+
+  /**
+   * Creates an instance of the "taxonomy_vocabulary" entity.
+   *
+   * @param array $settings
+   *   A list of settings.
+   *
+   * @return \stdClass
+   *   An instance of the "taxonomy_vocabulary" entity.
+   */
+  protected function drupalCreateTaxonomyVocabulary(array $settings = array()) {
+    $name = $this->randomName();
+    $vocabulary = (object) ($settings + array(
+      'name' => $name,
+      'machine_name' => drupal_strtolower($name),
+    ));
+
+    taxonomy_vocabulary_save($vocabulary);
+
+    return $vocabulary;
+  }
+
+  /**
+   * Creates an instance of the "taxonomy_term" entity.
+   *
+   * @param \stdClass $vocabulary
+   *   An instance of the "taxonomy_vocabulary" to which the term will belong.
+   * @param array $settings
+   *   A list of settings.
+   *
+   * @return \stdClass
+   *   An instance of the "taxonomy_term" entity.
+   */
+  protected function drupalCreateTaxonomyTerm(\stdClass $vocabulary, array $settings = array()) {
+    $term = (object) ($settings + array(
+      'vid' => $vocabulary->vid,
+      'name' => $this->randomName(),
+      'uuid' => uuid_generate(),
+      'weight' => 0,
+      'parent' => 0,
+      'language' => LANGUAGE_NONE,
+      // Set the property here to not call the "taxonomy_vocabulary_load()"
+      // during saving.
+      'vocabulary_machine_name' => $vocabulary->machine_name,
+    ));
+
+    taxonomy_term_save($term);
+
+    return $term;
+  }
+
+  /**
+   * Adds new conditional fields dependency.
+   */
+  protected function addDependency() {
+    $base = array(
+      'condition' => 'value',
+      'state' => 'visible',
+    );
+
+    $queries = array();
+    $config = array();
+
+    $this->drupalPost(
+      "admin/structure/types/manage/{$this->contentType->type}/dependencies",
+      $base + array(
+        'dependent' => $this->fieldInstances['field_text']['id'],
+        'dependee' => $this->fieldInstances['field_reference']['id'],
+      ),
+      t('Add dependency')
+    );
+
+    $queries['value']['field']['field_reference'][LANGUAGE_NONE] = $this->getWidgetValueForm();
+    $queries['values_set'] = CONDITIONAL_FIELDS_DEPENDENCY_VALUES_WIDGET;
+
+    // Build HTML "name" attributes from nested arrays.
+    foreach (explode('&', drupal_http_build_query($queries)) as $query) {
+      list($query, $value) = explode('=', $query);
+      // Restore initial string as a value.
+      $config[$query] = rawurldecode($value);
+    }
+
+    $this->drupalPost(NULL, $base + $config, t('Save settings'));
+    $this->assertNoRaw('messages error', 'The field condition has been successfully saved.');
+  }
+
+  /**
+   * Generates the feature with exported conditional fields.
+   *
+   * @return array[]
+   *   - 0 <array>: exported configuration.
+   *   - 1 <array[]>: components to rebuild.
+   */
+  protected function generateFeature() {
+    // What is 58? Good question! Check references below.
+    /* @see features_dom_encode_options() */
+    /* @see features_dom_encode_map() */
+    $conditional_field = self::ENTITY_TYPE . '__58__' . $this->contentType->type;
+    $features_component = 'conditional_fields';
+    $features_module_name = uniqid('test_feature');
+
+    $config = array(
+      'name' => 'Test feature',
+      'module_name' => $features_module_name,
+      'generate_path' => "sites/default/modules/simpletest",
+      "dependencies[sources][selected][$features_component]" => $features_component,
+      "{$features_component}[sources][selected][$conditional_field]" => $conditional_field,
+    );
+
+    $this->drupalPost('admin/structure/features/create', $config, t('Generate feature'));
+
+    $this->assertTrue(
+      module_enable(array($features_module_name)),
+      'A generated feature has been successfully enabled.'
+    );
+
+    $this->resetAll();
+
+    return array(
+      features_get_default($features_component, $features_module_name) ?: array(),
+      array($features_module_name => array($features_component)),
+    );
+  }
+
+  /**
+   * Loads conditional fields dependencies.
+   *
+   * @return array[]
+   *   Conditional fields dependencies.
+   */
+  protected function loadDependencies() {
+    $function = 'conditional_fields_load_dependencies';
+
+    drupal_static_reset($function);
+
+    return $function(self::ENTITY_TYPE, $this->contentType->type);
+  }
+
+  /**
+   * Checks that export/import of referenced entities operates by UUIDs.
+   *
+   * @internal
+   */
+  public function testExportImport() {
+    $this->drupalLogin($this->user);
+    $this->addDependency();
+
+    list($defaults, $components) = $this->generateFeature();
+
+    // After generating the feature its codebase must have UUIDs instead of
+    // entity IDs. Let's check this.
+    foreach (array(
+      'value_form' => $this->getWidgetValueForm($this->term->uuid),
+      'value' => $this->getWidgetValue($this->term->uuid),
+    ) as $key => $value) {
+      foreach ($defaults[self::ENTITY_TYPE . ':' . $this->contentType->type] as $dependee) {
+        $this->assertTrue(
+          $value === $dependee['options'][$key],
+          'Entity ID has been successfully replaced by UUID in generated feature.'
+        );
+      }
+    }
+
+    // Remove all conditions.
+    db_delete('conditional_fields')->execute();
+    // And ensure they were removed.
+    $this->assertFalse($this->loadDependencies(), 'No dependencies exist after removal.');
+
+    // Revert the feature.
+    features_rebuild($components);
+    // And load dependencies again.
+    $dependencies = $this->loadDependencies();
+
+    // After reverting the feature all UUIDs must had been converted to IDs.
+    foreach (array(
+      'value_form' => $this->getWidgetValueForm($this->term->tid),
+      'value' => $this->getWidgetValue($this->term->tid),
+    ) as $key => $value) {
+      foreach ($dependencies['dependees']['field_reference'] as $id => $dependee) {
+        $this->assertTrue(
+          $value === $dependee['options'][$key],
+          'Entity UUID has been successfully replaced by ID after rebuilding the feature.'
+        );
+      }
+    }
+  }
+
+}
diff --git a/src/Tests/EntityReferenceFeaturesUuidExportImport/HierarchicalSelectWidgetTest.php b/src/Tests/EntityReferenceFeaturesUuidExportImport/HierarchicalSelectWidgetTest.php
new file mode 100644
index 0000000..e50765a
--- /dev/null
+++ b/src/Tests/EntityReferenceFeaturesUuidExportImport/HierarchicalSelectWidgetTest.php
@@ -0,0 +1,59 @@
+<?php
+
+namespace Drupal\conditional_fields\Tests\EntityReferenceFeaturesUuidExportImport;
+
+/**
+ * Class HierarchicalSelectWidgetTest.
+ */
+class HierarchicalSelectWidgetTest extends AutocompleteWidgetTest {
+
+  /**
+   * {@inheritdoc}
+   */
+  protected $modules = array('hser');
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function getWidget() {
+    return array(
+      'type' => 'hser_hierarchy',
+      'active' => TRUE,
+      'module' => 'hser',
+      'settings' => array(
+        'match_operator' => 'CONTAINS',
+        'size' => 60,
+        'path' => '',
+        'editable' => FALSE,
+      ),
+    );
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function getWidgetValue($value = NULL) {
+    if (NULL === $value) {
+      $value = $this->term->tid;
+    }
+
+    return array(array('target_id' => $value));
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function getWidgetValueForm($value = NULL) {
+    if (NULL === $value) {
+      $value = $this->term->tid;
+    }
+
+    return array(
+      'hsid' => '59af2a36e3799',
+      'hierarchical_select' => array(
+        'selects' => array($value),
+      ),
+    );
+  }
+
+}
