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

fix(cdk/schematics): avoid runtime errors thrown by devkit tree when TypeScript tries non-existent path #22982

Merged
merged 1 commit into from Jun 16, 2021

Commits on Jun 15, 2021

  1. fix(cdk/schematics): avoid runtime errors thrown by devkit tree

    TypeScript resolves modules using a rather complicated module
    resolution algorithm. The algorithm tries various paths to
    determine a possible entry-point for a module. e.g. it also
    respects a containing `package.json` file, or respects the closest
    `node_modules` parent directory.
    
    In some situations, TypeScript could end up trying a path where
    a parent directory segment resolves to an existent file. e.g.
    
    consider the following directory structure:
    
    ```
    node_modules/my-pkg/package.json
    node_modules/my-pkg/styles.css
    ```
    
    TypeScript could end up trying a path like:
    `node_modules/my-pkg/styles.css/package.json` or
    `node_modules/my-pkg/styles.css/a/b/package.json`. This depends on how
    the module resolution executes, and how the module is referenced. In the
    example above though, TypeScript checks if the files exist. Our update
    logic delegates this check to our virtual file system. The virtual file
    system currently would throw an error by accident as it walks up the
    path and discovers that `styles.css` is not a directory, _but_ a file.
    
    This results in an error as seen in
    angular#22919.
    
    Fixes angular#22919.
    devversion committed Jun 15, 2021
    Copy the full SHA
    d61ca54 View commit details
    Browse the repository at this point in the history