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

Bug: exports field is not respected when running under PnP #270

Closed
merceyz opened this issue Dec 21, 2020 · 1 comment · Fixed by #271
Closed

Bug: exports field is not respected when running under PnP #270

merceyz opened this issue Dec 21, 2020 · 1 comment · Fixed by #271

Comments

@merceyz
Copy link
Contributor

merceyz commented Dec 21, 2020

Describe the bug

When running enhanced-resolve under Yarn PnP the exports field is not respected

To Reproduce

Setup:

mkdir repro && cd repro
yarn init -y
yarn set version berry
yarn add enhanced-resolve rollup

Code:

import { ResolverFactory, CachedInputFileSystem } from 'enhanced-resolve';
import fs from 'fs';

const cachedFS = new CachedInputFileSystem(fs);

const resolver = ResolverFactory.createResolver({
	fileSystem: cachedFS,
	conditionNames: ['node', 'import'],
});

resolver.resolve({}, __filename, 'rollup', {}, (err, filepath) => {
	console.log(filepath)
	// filepath ends with `rollup\dist\es\rollup.js` when running under node_modules
	// and `rollup\dist\rollup.js` when running under PnP
});
@merceyz
Copy link
Contributor Author

merceyz commented Dec 21, 2020

Thanks for the quick fix!

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 a pull request may close this issue.

1 participant