diff --git a/docs/Configuration.md b/docs/Configuration.md index f62e22b8f..b61517d03 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -103,6 +103,14 @@ A list of directories outside of [`projectRoot`](#projectroot) that can contain Despite the naming of this option, it isn't related solely to file watching. Even in an offline build (for example, in CI), all files must be visible to Metro through the combination of `watchFolders` and `projectRoot`. ::: +:::info + +Note that, as with any other file Metro needs to resolve, targets of any symlinks within your `watchFolders` *must also be within `watchFolders`* and not otherwise excluded. + +If you have a Metro project within a workspace, such as a [Yarn workspace](https://classic.yarnpkg.com/lang/en/docs/workspaces/) (a subdirectory of a Yarn workspace root), it's likely you'll want to include your workspace *root* path in your configured `watchFolders` so that Metro can resolve other workspaces or hoisted `node_modules`. Similarly, to use [linked packages](https://classic.yarnpkg.com/lang/en/docs/cli/link/), you'll need to list those package source locations (or a containing directory) in `watchFolders`. + +::: + #### `transformerPath` Type: `string` @@ -391,30 +399,6 @@ In a future release of Metro, this option will become `true` by default. --- -#### `unstable_enableSymlinks`
Experimental
- -Type: `boolean` - -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 `true` since Metro v0.79.0. - -:::info - -For example, if you have a Metro project within a [Yarn workspace](https://classic.yarnpkg.com/lang/en/docs/workspaces/) (a subdirectory of a Yarn workspace root), it's likely you'll want to include your workspace *root* path in your configured [`watchFolders`](#watchfolders) so that Metro can resolve other workspaces or hoisted `node_modules`. Similarly, to use [linked packages](https://classic.yarnpkg.com/lang/en/docs/cli/link/), you'll need to list those package source locations (or a containing directory) in [`watchFolders`](#watchfolders). - -::: - -:::note - -In a future release of Metro, this option will be removed (symlink support will be always-on). - -::: - ---- - ### Transformer Options 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 0d8192fa3..fa73975b8 100644 --- a/packages/metro-config/src/__tests__/__snapshots__/loadConfig-test.js.snap +++ b/packages/metro-config/src/__tests__/__snapshots__/loadConfig-test.js.snap @@ -85,7 +85,6 @@ Object { ], }, "unstable_enablePackageExports": false, - "unstable_enableSymlinks": true, "useWatchman": true, }, "serializer": Object { @@ -269,7 +268,6 @@ Object { ], }, "unstable_enablePackageExports": false, - "unstable_enableSymlinks": true, "useWatchman": true, }, "serializer": Object { @@ -453,7 +451,6 @@ Object { ], }, "unstable_enablePackageExports": false, - "unstable_enableSymlinks": true, "useWatchman": true, }, "serializer": Object { @@ -637,7 +634,6 @@ Object { ], }, "unstable_enablePackageExports": false, - "unstable_enableSymlinks": true, "useWatchman": true, }, "serializer": Object { diff --git a/packages/metro-config/src/configTypes.flow.js b/packages/metro-config/src/configTypes.flow.js index beed58021..ea3468880 100644 --- a/packages/metro-config/src/configTypes.flow.js +++ b/packages/metro-config/src/configTypes.flow.js @@ -105,7 +105,6 @@ type ResolverConfigT = { dependencyExtractor: ?string, emptyModulePath: string, enableGlobalPackages: boolean, - unstable_enableSymlinks: boolean, extraNodeModules: {[name: string]: string, ...}, hasteImplModulePath: ?string, nodeModulesPaths: $ReadOnlyArray, diff --git a/packages/metro-config/src/defaults/index.js b/packages/metro-config/src/defaults/index.js index a480e3315..07192a827 100644 --- a/packages/metro-config/src/defaults/index.js +++ b/packages/metro-config/src/defaults/index.js @@ -40,7 +40,6 @@ const getDefaultValues = (projectRoot: ?string): ConfigT => ({ blockList: exclusionList(), dependencyExtractor: undefined, disableHierarchicalLookup: false, - unstable_enableSymlinks: true, emptyModulePath: require.resolve( 'metro-runtime/src/modules/empty-module.js', ), diff --git a/packages/metro-config/types/configTypes.d.ts b/packages/metro-config/types/configTypes.d.ts index e7fbe5223..c88a96230 100644 --- a/packages/metro-config/types/configTypes.d.ts +++ b/packages/metro-config/types/configTypes.d.ts @@ -107,7 +107,6 @@ export interface ResolverConfigT { resolveRequest?: CustomResolver; resolverMainFields: ReadonlyArray; sourceExts: ReadonlyArray; - unstable_enableSymlinks: boolean; unstable_conditionNames: ReadonlyArray; unstable_conditionsByPlatform: Readonly<{ [platform: string]: ReadonlyArray; diff --git a/packages/metro/src/node-haste/DependencyGraph/createFileMap.js b/packages/metro/src/node-haste/DependencyGraph/createFileMap.js index 1533b9416..c8ffd7fa0 100644 --- a/packages/metro/src/node-haste/DependencyGraph/createFileMap.js +++ b/packages/metro/src/node-haste/DependencyGraph/createFileMap.js @@ -83,7 +83,7 @@ function createFileMap( computeSha1: true, dependencyExtractor: config.resolver.dependencyExtractor, enableHastePackages: config?.resolver.enableGlobalPackages, - enableSymlinks: config.resolver.unstable_enableSymlinks, + enableSymlinks: true, enableWorkerThreads: config.watcher.unstable_workerThreads, extensions: Array.from( new Set([