Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable symlinks (resolver.unstable_enableSymlinks) by default #1068

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions docs/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,30 @@ In a future release of Metro, this option will become `true` by default.

---

#### `unstable_enableSymlinks` <div class="label experimental">Experimental</div>

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

<!-- Keep old links to `asyncRequireModulePath` working -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Object {
],
},
"unstable_enablePackageExports": false,
"unstable_enableSymlinks": false,
"unstable_enableSymlinks": true,
"useWatchman": true,
},
"serializer": Object {
Expand Down Expand Up @@ -262,7 +262,7 @@ Object {
],
},
"unstable_enablePackageExports": false,
"unstable_enableSymlinks": false,
"unstable_enableSymlinks": true,
"useWatchman": true,
},
"serializer": Object {
Expand Down Expand Up @@ -440,7 +440,7 @@ Object {
],
},
"unstable_enablePackageExports": false,
"unstable_enableSymlinks": false,
"unstable_enableSymlinks": true,
"useWatchman": true,
},
"serializer": Object {
Expand Down Expand Up @@ -618,7 +618,7 @@ Object {
],
},
"unstable_enablePackageExports": false,
"unstable_enableSymlinks": false,
"unstable_enableSymlinks": true,
"useWatchman": true,
},
"serializer": Object {
Expand Down
2 changes: 1 addition & 1 deletion packages/metro-config/src/defaults/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
),
Expand Down