From 9e7cec1b80ba4e843f3260437be04c3896299916 Mon Sep 17 00:00:00 2001 From: Rob Hogan Date: Wed, 30 Aug 2023 10:24:08 -0700 Subject: [PATCH] Enable symlinks (`resolver.unstable_enableSymlinks`) by default (#1068) Summary: Pull Request resolved: https://github.com/facebook/metro/pull/1068 Flip the default for `unstable_enableSymlinks` to true. The option was made available in React Native 0.72 and it's been trialled by the community to the extent that we can have good confidence in it (though there are still devx gaps to guide users towards a suitable configuration). This is also an effective prerequisite for disabling Haste/global package resolution by default in OSS, which currently allows workspaces to mostly-work in the absence of symlink support. Closes https://github.com/facebook/metro/issues/1 Changelog: ``` - **[Feature]**: Enable resolution through symlinks (previously experimental `unstable_enableSymlinks`) ``` Reviewed By: motiz88 Differential Revision: D48777855 fbshipit-source-id: bc3d4acad2f8e19d5f0d118ecbf789663eaca2ce --- docs/Configuration.md | 4 ++-- .../src/__tests__/__snapshots__/loadConfig-test.js.snap | 8 ++++---- packages/metro-config/src/defaults/index.js | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/Configuration.md b/docs/Configuration.md index c67f9e9d5e..8d61fae029 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -403,7 +403,7 @@ Enable experimental support for projects containing symbolic links (symlinks). When enabled, Metro traverses symlinks during module and asset [resolution](./Resolution.md), instead of ignoring symlinks. Note that, as with any other file Metro needs to resolve, the symlink target *must be within configured [watched folders](#watchfolders)* and not otherwise excluded. -Defaults to `false`. +Defaults to `true` since Metro v0.79.0. :::info @@ -413,7 +413,7 @@ For example, if you have a Metro project within a [Yarn workspace](https://class :::note -In a future release of Metro, this option will become `true` by default. +In a future release of Metro, this option will be removed (symlink support will be always-on). ::: diff --git a/packages/metro-config/src/__tests__/__snapshots__/loadConfig-test.js.snap b/packages/metro-config/src/__tests__/__snapshots__/loadConfig-test.js.snap index 81082e13a5..4c5e91284e 100644 --- a/packages/metro-config/src/__tests__/__snapshots__/loadConfig-test.js.snap +++ b/packages/metro-config/src/__tests__/__snapshots__/loadConfig-test.js.snap @@ -84,7 +84,7 @@ Object { ], }, "unstable_enablePackageExports": false, - "unstable_enableSymlinks": false, + "unstable_enableSymlinks": true, "useWatchman": true, }, "serializer": Object { @@ -262,7 +262,7 @@ Object { ], }, "unstable_enablePackageExports": false, - "unstable_enableSymlinks": false, + "unstable_enableSymlinks": true, "useWatchman": true, }, "serializer": Object { @@ -440,7 +440,7 @@ Object { ], }, "unstable_enablePackageExports": false, - "unstable_enableSymlinks": false, + "unstable_enableSymlinks": true, "useWatchman": true, }, "serializer": Object { @@ -618,7 +618,7 @@ Object { ], }, "unstable_enablePackageExports": false, - "unstable_enableSymlinks": false, + "unstable_enableSymlinks": true, "useWatchman": true, }, "serializer": Object { diff --git a/packages/metro-config/src/defaults/index.js b/packages/metro-config/src/defaults/index.js index fd557645b6..2e4bc1adeb 100644 --- a/packages/metro-config/src/defaults/index.js +++ b/packages/metro-config/src/defaults/index.js @@ -40,7 +40,7 @@ const getDefaultValues = (projectRoot: ?string): ConfigT => ({ blockList: exclusionList(), dependencyExtractor: undefined, disableHierarchicalLookup: false, - unstable_enableSymlinks: false, + unstable_enableSymlinks: true, emptyModulePath: require.resolve( 'metro-runtime/src/modules/empty-module.js', ),