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

Implements the pnp hook for the resolve package #6816

Merged
merged 3 commits into from Dec 14, 2018

Conversation

arcanis
Copy link
Member

@arcanis arcanis commented Dec 14, 2018

Summary

This PR adds builtin resolve support using the mechanisms described in browserify/resolve#174. I've also added an escape hatch (forceNodeResolution) in case something goes awry.

cc @ljharb

Test plan

Added an automated test.

@buildsize
Copy link

buildsize bot commented Dec 14, 2018

File name Previous Size New Size Change
yarn-[version].noarch.rpm 1.11 MB 1.11 MB -422 bytes (0%)
yarn-[version].js 4.47 MB 4.47 MB -1.07 KB (0%)
yarn-legacy-[version].js 4.66 MB 4.66 MB -1.07 KB (0%)
yarn-v[version].tar.gz 1.12 MB 1.12 MB -175 bytes (0%)
yarn_[version]all.deb 815.38 KB 815.34 KB -32 bytes (0%)

@arcanis
Copy link
Member Author

arcanis commented Dec 14, 2018

In the meantime until the resolve consumer packages (such as liftoff, used by Gulp) have fully upgraded to the later version, the recommended workaround is to force the use of the modern version through the resolutions field:

{
  "resolutions": {
    "resolve": "npm:resolve@1.9.0"
  }
}

@arcanis arcanis merged commit 1cf0490 into yarnpkg:master Dec 14, 2018
@imsnif
Copy link
Member

imsnif commented Dec 18, 2018

Just FYI: this also fixes an issue with specifying plugin names in a babelrc file (in my case it was .babelrc.js).

The issue was due to the same resolve package being used here: https://github.com/babel/babel/blob/e85faec47d5d3ef940b7a85d48fa24e6e1cc32ab/packages/babel-core/src/config/files/plugins.js#L99

After this fix it works great and you do not have to specify require.resolve for your plugins/presets.

@ljharb
Copy link

ljharb commented Dec 18, 2018

resolve v1.9 was released last night, fwiw

asfgit pushed a commit to apache/camel-website that referenced this pull request Jan 4, 2019
Yarn 13+ patches `resolve` module to resolve from PnP[1].

[1] yarnpkg/yarn#6816
asfgit pushed a commit to apache/camel-website that referenced this pull request Jan 4, 2019
Yarn 13+ patches `resolve` module to resolve from PnP[1].

[1] yarnpkg/yarn#6816
asfgit pushed a commit to apache/camel-website that referenced this pull request Jan 4, 2019
Yarn 13+ patches `resolve` module to resolve from PnP[1].

[1] yarnpkg/yarn#6816
asfgit pushed a commit to apache/camel-website that referenced this pull request Jan 4, 2019
Yarn 13+ patches `resolve` module to resolve from PnP[1].

[1] yarnpkg/yarn#6816
asfgit pushed a commit to apache/camel-website that referenced this pull request Jan 7, 2019
Yarn 13+ patches `resolve` module to resolve from PnP[1].

[1] yarnpkg/yarn#6816
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Jan 17, 2019
## 1.13.0

- Implements a new `package.json` field: `peerDependenciesMeta`

  [6671](yarnpkg/yarn#6671) - [**Maël Nison**](https://twitter.com/arcanis)

- Adds an `optional` settings to `peerDependenciesMeta` to silence missing peer dependency warnings

  [6671](yarnpkg/yarn#6671) - [**Maël Nison**](https://twitter.com/arcanis)

- Implements `yarn policies set-version [range]`. Check [the documentation]() for usage & tips.

  [6673](yarnpkg/yarn#6673) - [**Maël Nison**](https://twitter.com/arcanis)

- Fixes a resolution issue when a package had an invalid `main` entry

  [6682](yarnpkg/yarn#6682) - [**Maël Nison**](https://twitter.com/arcanis)

- Decreases the size of the generated `$PATH` environment variable for a better Windows support

  [6683](yarnpkg/yarn#6683) - [**Rowan Lonsdale**](https://github.com/hWorblehat)

- Fixes postinstall scripts for third-party packages when they were referencing a binary from their own dependencies

  [6712](yarnpkg/yarn#6712) - [**Maël Nison**](https://twitter.com/arcanis)

- Fixes yarn audit exit code overflow

  [6748](yarnpkg/yarn#6748) - [**Andrey Vetlugin**](https://github.com/antrew)

- Stops automatically unplugging packages with postinstall script when running under `--ignore-scripts`

  [6820](yarnpkg/yarn#6820) - [**Maël Nison**](https://twitter.com/arcanis)

- Adds transparent support for the [`resolve`](https://github.com/browserify/resolve) package when using Plug'n'Play

  [6816](yarnpkg/yarn#6816) - [**Maël Nison**](https://twitter.com/arcanis)

- Properly reports the error codes when the npm registry throws 500's

  [6817](yarnpkg/yarn#6817) - [**Maël Nison**](https://twitter.com/arcanis)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants