title: Can't resolve Typescript module in another file
body: <p>I'm migrating my react app to typescript. It works fine now, But after adding typescript compiler and renaming files to .ts and .tsx, its throwing module not found. Any lead will be helpful. I have got the following dir structure.</p>
  <pre><code>| src
    | select.tsx
    | index.ts
    | WindowedSelect.tsx
    | MenuList.tsx
  | demo
    | index.tsx
  | webpack.config.demo.js
  | webpack.config.js
  | tsconfig.json
  | package.json
  </code></pre>
  <p>I run demo/index (<code>webpack.config.demo</code>) for <code>npm start</code> command and src/index.tsx (webpack.config) for <code>npm run build</code>. But getting Moddule Not found error in both.</p>
  <p>Error (npm start):</p>
  <pre><code>ERROR in ./demo/index.tsx
  Module not found: Error: Can't resolve '../src/WindowedSelect'
  </code></pre>
  <p>Error (npm run build):</p>
  <pre><code>ERROR in ./src/index.ts
  Module not found: Error: Can't resolve './MenuList'
  
  ERROR in ./src/index.ts
  Module not found: Error: Can't resolve './WindowedSelect'
  </code></pre>
  <p>The IntelliSense works fine and navigates to corresponding files on click. I don't understand what is the issue here.</p>
  <p>PS: apart from the module not found error, there are also several type errors as this is a js project. The plan is to gradually migrate to typescript. So how to set the default severity to &quot;warn&quot; for type errors?</p>
  <p>webpack.config.js</p>
  <pre><code>const path = require('path');
  
  module.exports = {
    entry: './src/index.ts',
    output: {
      filename: 'main.js',
      path: path.resolve(__dirname, 'dist'),
      libraryTarget: 'commonjs2',
    },
    module: {
      rules: [
        {
          test: /\.(ts|tsx)$/,
          exclude: /node_modules/,
          use: {
            loader: &quot;ts-loader&quot;
          }
        }
      ]
    },
    externals: {
      react: 'commonjs react',
      'react-dom': 'commonjs react-dom'
    },
  };
  </code></pre>
  <p>Edit: tsconfig.json</p>
  <pre><code>{
    &quot;compilerOptions&quot;: {
      /* Visit https://aka.ms/tsconfig.json to read more about this file */
  
      /* Basic Options */
      // &quot;incremental&quot;: true,                   /* Enable incremental compilation */
      &quot;target&quot;: &quot;es5&quot;,                          /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
      &quot;module&quot;: &quot;commonjs&quot;,                     /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
      &quot;lib&quot;: [                                  /* Specify library files to be included in the compilation. */
        &quot;DOM&quot;,
        &quot;DOM.Iterable&quot;,
        &quot;ESNext&quot;
      ],
      &quot;allowJs&quot;: true,                          /* Allow javascript files to be compiled. */
      // &quot;checkJs&quot;: true,                       /* Report errors in .js files. */
      &quot;jsx&quot;: &quot;react&quot;,                           /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
      // &quot;declaration&quot;: true,                   /* Generates corresponding '.d.ts' file. */
      // &quot;declarationMap&quot;: true,                /* Generates a sourcemap for each corresponding '.d.ts' file. */
      // &quot;sourceMap&quot;: true,                     /* Generates corresponding '.map' file. */
      // &quot;outFile&quot;: &quot;./&quot;,                       /* Concatenate and emit output to single file. */
      // &quot;outDir&quot;: &quot;./&quot;,                        /* Redirect output structure to the directory. */
      // &quot;rootDir&quot;: &quot;./&quot;,                       /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
      // &quot;composite&quot;: true,                     /* Enable project compilation */
      // &quot;tsBuildInfoFile&quot;: &quot;./&quot;,               /* Specify file to store incremental compilation information */
      // &quot;removeComments&quot;: true,                /* Do not emit comments to output. */
      // &quot;noEmit&quot;: true,                        /* Do not emit outputs. */
      // &quot;importHelpers&quot;: true,                 /* Import emit helpers from 'tslib'. */
      // &quot;downlevelIteration&quot;: true,            /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
      &quot;isolatedModules&quot;: true,                  /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
  
      /* Strict Type-Checking Options */
      &quot;strict&quot;: false,                           /* Enable all strict type-checking options. */
      &quot;noImplicitAny&quot;: false,                 /* Raise error on expressions and declarations with an implied 'any' type. */
      &quot;strictNullChecks&quot;: false,              /* Enable strict null checks. */
      &quot;strictFunctionTypes&quot;: false,           /* Enable strict checking of function types. */
      &quot;strictBindCallApply&quot;: false,           /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
      &quot;strictPropertyInitialization&quot;: false,  /* Enable strict checking of property initialization in classes. */
      &quot;noImplicitThis&quot;: false,                /* Raise error on 'this' expressions with an implied 'any' type. */
      &quot;alwaysStrict&quot;: false,                  /* Parse in strict mode and emit &quot;use strict&quot; for each source file. */
  
      /* Additional Checks */
      // &quot;noUnusedLocals&quot;: true,                /* Report errors on unused locals. */
      // &quot;noUnusedParameters&quot;: true,            /* Report errors on unused parameters. */
      // &quot;noImplicitReturns&quot;: true,             /* Report error when not all code paths in function return a value. */
      // &quot;noFallthroughCasesInSwitch&quot;: true,    /* Report errors for fallthrough cases in switch statement. */
  
      /* Module Resolution Options */
      // &quot;moduleResolution&quot;: &quot;node&quot;,            /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
      // &quot;baseUrl&quot;: &quot;./&quot;,                       /* Base directory to resolve non-absolute module names. */
      // &quot;paths&quot;: {},                           /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
      // &quot;rootDirs&quot;: [],                        /* List of root folders whose combined content represents the structure of the project at runtime. */
      // &quot;typeRoots&quot;: [],                       /* List of folders to include type definitions from. */
      // &quot;types&quot;: [],                           /* Type declaration files to be included in compilation. */
      // &quot;allowSyntheticDefaultImports&quot;: true,  /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
      &quot;esModuleInterop&quot;: true,                  /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
      // &quot;preserveSymlinks&quot;: true,              /* Do not resolve the real path of symlinks. */
      // &quot;allowUmdGlobalAccess&quot;: true,          /* Allow accessing UMD globals from modules. */
  
      /* Source Map Options */
      // &quot;sourceRoot&quot;: &quot;&quot;,                      /* Specify the location where debugger should locate TypeScript files instead of source locations. */
      // &quot;mapRoot&quot;: &quot;&quot;,                         /* Specify the location where debugger should locate map files instead of generated locations. */
      // &quot;inlineSourceMap&quot;: true,               /* Emit a single file with source maps instead of having a separate file. */
      // &quot;inlineSources&quot;: true,                 /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
  
      /* Experimental Options */
      // &quot;experimentalDecorators&quot;: true,        /* Enables experimental support for ES7 decorators. */
      // &quot;emitDecoratorMetadata&quot;: true,         /* Enables experimental support for emitting type metadata for decorators. */
  
      /* Advanced Options */
      &quot;skipLibCheck&quot;: true,                     /* Skip type checking of declaration files. */
      &quot;forceConsistentCasingInFileNames&quot;: true  /* Disallow inconsistently-cased references to the same file. */
    }
  }
  
  </code></pre>