Skip to content

Modules not correctly resolved when in another subdirectory installed #37668

@alexander-schranz

Description

@alexander-schranz
  • Version:

v14.16.0

  • Platform:

MacOSX Mojava 10.14.6: Darwin 18.7.0 Darwin Kernel Version 18.7.0: Tue Jan 12 22:04:47 PST 2021; root:xnu-4903.278.56~1/RELEASE_X86_64 x86_64
Also on other platforms (ubuntu, windows)

  • Subsystem:

What steps will reproduce the bug?

We have a very uncomment directory structure: https://github.com/alexander-schranz/build-error-reproducer and so our babel plugins are installed in a none parent directory of our submodules.

To reproduce the issue:

git clone git@github.com:alexander-schranz/build-error-reproducer.git
cd assets/admin
npm install
npm run build

It will error with module not found as node does not look for the module in the process.cwd directory.

How often does it reproduce? Is there a required condition?

What is the expected behavior?

Babel module should be found which is loaded over require.resolve.

What do you see instead?

Does not find babel module.

Additional information

Submodules which are no direct parent of the directory. Node should look into process.cwd directory also as fallback for type of uncommen directory structure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    moduleIssues and PRs related to the module subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions