title: Field 'browser' doesn't contain a valid alias configuration in an angular 11 workspace importing mock component from library to project
body: <p>I am getting a <code>Field 'browser' doesn't contain a valid alias configuration</code></p>
  <p>My setup is quite standard (I haven't updated much of the conifg)</p>
  <p>There is one angular project and one angular library in a workspace</p>
  <pre><code> -common
   --src
   ---lib
   ----components 
   -----input
   -website
   --src
   ---app
   ----sign-up
  </code></pre>
  <p>I have a mock folder inside the input component that defines the @input and @output to use in tests. The app builds fine with the common component imported in, but tests are erroring.</p>
  <p>Mock component</p>
  <pre><code>import { Component, EventEmitter, Input, Output } from '@angular/core';
  import { InputConfig } from '../input.component';
  
  @Component({
    selector: 'lib-input',
    templateUrl: '',
  })
  export class MockInputComponent {
    @Input() config: InputConfig;
    @Output() valueChange: EventEmitter&lt;string | number&gt; = new EventEmitter&lt;string | number&gt;();
  }
  </code></pre>
  <p>Test set up</p>
  <pre><code>import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
  
  import { MockInputComponent } from '@common/components/partials/input/mocks/mock-input.component';
  
  import { SignUpComponent } from './sign-up.component';
  
  describe('SignUpComponent', () =&gt; {
    let component: SignUpComponent;
    let fixture: ComponentFixture&lt;SignUpComponent&gt;;
  
    beforeEach(waitForAsync( () =&gt; {
      TestBed.configureTestingModule({
        declarations: [SignUpComponent, MockInputComponent],
      })
        .compileComponents();
    }));
  
    beforeEach(() =&gt; {
      fixture = TestBed.createComponent(SignUpComponent);
      component = fixture.componentInstance;
      fixture.detectChanges();
    });
  
    it('should create', () =&gt; {
      expect(component).toBeTruthy();
    });
  });
  
  </code></pre>
  <p>My tsconfig</p>
  <pre><code>/* To learn more about this file see: https://angular.io/config/tsconfig. */
  {
    &quot;compileOnSave&quot;: false,
    &quot;compilerOptions&quot;: {
      &quot;baseUrl&quot;: &quot;./&quot;,
      &quot;paths&quot;: {
        &quot;@common/*&quot;: [&quot;projects/common/src/lib/*&quot;],
        &quot;@website/*&quot;: [&quot;projects/website/src/*&quot;]
      },
      &quot;resolveJsonModule&quot;: true,
      &quot;outDir&quot;: &quot;./dist/out-tsc&quot;,
      &quot;sourceMap&quot;: true,
      &quot;declaration&quot;: false,
      &quot;downlevelIteration&quot;: true,
      &quot;experimentalDecorators&quot;: true,
      &quot;moduleResolution&quot;: &quot;node&quot;,
      &quot;importHelpers&quot;: true,
      &quot;typeRoots&quot;: [&quot;node_modules/@types&quot;],
      &quot;forceConsistentCasingInFileNames&quot;: true,
      &quot;noFallthroughCasesInSwitch&quot;: true,
      &quot;noImplicitThis&quot;: true,
      &quot;strictNullChecks&quot;: true,
      &quot;alwaysStrict&quot;: true,
      &quot;target&quot;: &quot;es2015&quot;,
      &quot;module&quot;: &quot;es2020&quot;,
      &quot;lib&quot;: [&quot;es2019&quot;, &quot;dom&quot;],
    },
    &quot;angularCompilerOptions&quot;: {
      &quot;enableI18nLegacyMessageIdFormat&quot;: false,
      &quot;fullTemplateTypeCheck&quot;: true,
      &quot;strictInputAccessModifiers&quot;: true,
      &quot;strictInjectionParameters&quot;: true
    }
  }
  </code></pre>
  <p>In my library I have a common input, it all works fine in the project component, but when trying to import the mock of the component it gives that error when running tests. I assume there is some set up/config I haven't done yet, but I am scratching my head.</p>
  <p>Full error</p>
  <pre><code>Error: Entry module not found: Error: Can't resolve '/Users/julian/other/idea-2/web/projects/common/src/lib/components/partials/input/mocks' in '/Users/julian/other/idea-2/web'
  resolve '/Users/julian/other/idea-2/web/projects/common/src/lib/components/partials/input/mocks' in '/Users/julian/other/idea-2/web'
    using description file: /Users/julian/other/idea-2/web/package.json (relative path: .)
      Field 'browser' doesn't contain a valid alias configuration
      root path /Users/julian/other/idea-2/web/projects/website
        using description file: /Users/julian/other/idea-2/web/package.json (relative path: ./projects/website/Users/julian/other/idea-2/web/projects/common/src/lib/components/partials/input/mocks)
          no extension
            Field 'browser' doesn't contain a valid alias configuration
            /Users/julian/other/idea-2/web/projects/website/Users/julian/other/idea-2/web/projects/common/src/lib/components/partials/input/mocks doesn't exist
          .ts
            Field 'browser' doesn't contain a valid alias configuration
            /Users/julian/other/idea-2/web/projects/website/Users/julian/other/idea-2/web/projects/common/src/lib/components/partials/input/mocks.ts doesn't exist
          .tsx
            Field 'browser' doesn't contain a valid alias configuration
            /Users/julian/other/idea-2/web/projects/website/Users/julian/other/idea-2/web/projects/common/src/lib/components/partials/input/mocks.tsx doesn't exist
          .mjs
            Field 'browser' doesn't contain a valid alias configuration
            /Users/julian/other/idea-2/web/projects/website/Users/julian/other/idea-2/web/projects/common/src/lib/components/partials/input/mocks.mjs doesn't exist
          .js
            Field 'browser' doesn't contain a valid alias configuration
            /Users/julian/other/idea-2/web/projects/website/Users/julian/other/idea-2/web/projects/common/src/lib/components/partials/input/mocks.js doesn't exist
          as directory
            /Users/julian/other/idea-2/web/projects/website/Users/julian/other/idea-2/web/projects/common/src/lib/components/partials/input/mocks doesn't exist
      using description file: /Users/julian/other/idea-2/web/package.json (relative path: ./projects/common/src/lib/components/partials/input/mocks)
        no extension
          Field 'browser' doesn't contain a valid alias configuration
          /Users/julian/other/idea-2/web/projects/common/src/lib/components/partials/input/mocks is not a file
        .ts
          Field 'browser' doesn't contain a valid alias configuration
          /Users/julian/other/idea-2/web/projects/common/src/lib/components/partials/input/mocks.ts doesn't exist
        .tsx
          Field 'browser' doesn't contain a valid alias configuration
          /Users/julian/other/idea-2/web/projects/common/src/lib/components/partials/input/mocks.tsx doesn't exist
        .mjs
          Field 'browser' doesn't contain a valid alias configuration
          /Users/julian/other/idea-2/web/projects/common/src/lib/components/partials/input/mocks.mjs doesn't exist
        .js
          Field 'browser' doesn't contain a valid alias configuration
          /Users/julian/other/idea-2/web/projects/common/src/lib/components/partials/input/mocks.js doesn't exist
        as directory
          existing directory
            using path: /Users/julian/other/idea-2/web/projects/common/src/lib/components/partials/input/mocks/index
              using description file: /Users/julian/other/idea-2/web/package.json (relative path: ./projects/common/src/lib/components/partials/input/mocks/index)
                no extension
                  Field 'browser' doesn't contain a valid alias configuration
                  /Users/julian/other/idea-2/web/projects/common/src/lib/components/partials/input/mocks/index doesn't exist
                .ts
                  Field 'browser' doesn't contain a valid alias configuration
                  /Users/julian/other/idea-2/web/projects/common/src/lib/components/partials/input/mocks/index.ts doesn't exist
                .tsx
                  Field 'browser' doesn't contain a valid alias configuration
                  /Users/julian/other/idea-2/web/projects/common/src/lib/components/partials/input/mocks/index.tsx doesn't exist
                .mjs
                  Field 'browser' doesn't contain a valid alias configuration
                  /Users/julian/other/idea-2/web/projects/common/src/lib/components/partials/input/mocks/index.mjs doesn't exist
                .js
                  Field 'browser' doesn't contain a valid alias configuration
                  /Users/julian/other/idea-2/web/projects/common/src/lib/components/partials/input/mocks/index.js doesn't exist
  
  Error: ./projects/common/src/lib/components/partials/input/mocks/mock-input.component.ts
  Module not found: Error: Can't resolve './' in '/Users/julian/other/idea-2/web/projects/common/src/lib/components/partials/input/mocks'9m
  resolve './' in '/Users/julian/other/idea-2/web/projects/common/src/lib/components/partials/input/mocks'
    Parsed request is a directory
    using description file: /Users/julian/other/idea-2/web/package.json (relative path: ./projects/common/src/lib/components/partials/input/mocks)
      Field 'browser' doesn't contain a valid alias configuration
      using description file: /Users/julian/other/idea-2/web/package.json (relative path: ./projects/common/src/lib/components/partials/input/mocks)
        as directory
          existing directory
            using path: /Users/julian/other/idea-2/web/projects/common/src/lib/components/partials/input/mocks/index
              using description file: /Users/julian/other/idea-2/web/package.json (relative path: ./projects/common/src/lib/components/partials/input/mocks/index)
                no extension
                  Field 'browser' doesn't contain a valid alias configuration
                  /Users/julian/other/idea-2/web/projects/common/src/lib/components/partials/input/mocks/index doesn't exist
                .ts
                  Field 'browser' doesn't contain a valid alias configuration
                  /Users/julian/other/idea-2/web/projects/common/src/lib/components/partials/input/mocks/index.ts doesn't exist
                .tsx
                  Field 'browser' doesn't contain a valid alias configuration
                  /Users/julian/other/idea-2/web/projects/common/src/lib/components/partials/input/mocks/index.tsx doesn't exist
                .mjs
                  Field 'browser' doesn't contain a valid alias configuration
                  /Users/julian/other/idea-2/web/projects/common/src/lib/components/partials/input/mocks/index.mjs doesn't exist
                .js
                  Field 'browser' doesn't contain a valid alias configuration
                  /Users/julian/other/idea-2/web/projects/common/src/lib/components/partials/input/mocks/index.js doesn't exist
  [/Users/julian/other/idea-2/web/projects/common/src/lib/components/partials/input/mocks/index]
  [/Users/julian/other/idea-2/web/projects/common/src/lib/components/partials/input/mocks/index.ts]
  [/Users/julian/other/idea-2/web/projects/common/src/lib/components/partials/input/mocks/index.tsx]
  [/Users/julian/other/idea-2/web/projects/common/src/lib/components/partials/input/mocks/index.mjs]
  [/Users/julian/other/idea-2/web/projects/common/src/lib/components/partials/input/mocks/index.js]
   @ ./projects/common/src/lib/components/partials/input/mocks/mock-input.component.ts 2:0-50 16:18-38
   @ ./projects/website/src/app/sign-up/sign-up.component.spec.ts
   @ ./projects/website/src sync \.spec\.ts$
   @ ./projects/website/src/test.ts
  </code></pre>