Skip to content

Crashes webpack when used in conjunction with pnpIgnorePatterns #29

@andreialecu

Description

@andreialecu

Repro at: https://github.com/andreialecu/repro-yarn-nm-pnp

nm-packages is under pnpIgnorePatterns. Trying to run yarn start:nm fails with:

[error] Error: the specified module doesn't seem to be part of the dependency tree
    at getModuleLocator (/home/aandrei/projects/repros/yarn-nm-pnp/nm-packages/angular/node_modules/pnp-webpack-plugin/index.js:21:11)
    at Object.module.exports.moduleLoader (/home/aandrei/projects/repros/yarn-nm-pnp/nm-packages/angular/node_modules/pnp-webpack-plugin/index.js:140:23)
    at Object.getCommonConfig (/home/aandrei/projects/repros/yarn-nm-pnp/nm-packages/angular/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/common.js:390:40)
    at webpackPartialGenerator (/home/aandrei/projects/repros/yarn-nm-pnp/nm-packages/angular/node_modules/@angular-devkit/build-angular/src/browser/index.js:59:27)
    at generateWebpackConfig (/home/aandrei/projects/repros/yarn-nm-pnp/nm-packages/angular/node_modules/@angular-devkit/build-angular/src/utils/webpack-browser-config.js:63:22)
    at async generateBrowserWebpackConfigFromContext (/home/aandrei/projects/repros/yarn-nm-pnp/nm-packages/angular/node_modules/@angular-devkit/build-angular/src/utils/webpack-browser-config.js:154:20)
    at async Object.generateI18nBrowserWebpackConfigFromContext (/home/aandrei/projects/repros/yarn-nm-pnp/nm-packages/angular/node_modules/@angular-devkit/build-angular/src/utils/webpack-browser-config.js:95:20)
    at async setup (/home/aandrei/projects/repros/yarn-nm-pnp/nm-packages/angular/node_modules/@angular-devkit/build-angular/src/dev-server/index.js:78:47)

if (!moduleLocation)
throw new Error(`The specified module doesn't seem to exist on the filesystem`);
will be null if the path is under a pnpIgnorePattern path as per yarnpkg/berry#2055

I guess instead of a hard crash there should be a fallback to plain webpack resolution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions