title: Webpack NestJS does not find nested imports under Windows 10
body: <p>I'm working on a uni project with colleagues and the following error just pops up on Windows 10 (I shortened the middle part of the path). Seems that under Windows the import is resolved via an absolute path and somehow "../" is included upfront. We are using NestJS, Typescript and Webpack.
  All other imports work without any problems, just all nested imports of our Dtos seem to fail. </p>
  
  <pre><code>ERROR in ./src/foo/dto/test.dto.ts
  Module not found: Error: Can't resolve '../C:\project\api\src\foo\dto\reference.dto' in 'C:\project\api\src\foo\dto'
  </code></pre>
  
  <p>TestDto and ReferenceDto are in the same folder. Source Code:</p>
  
  <pre><code>import { ReferenceDto } from './reference.dto';
  
  export class TestDto {
    references: ReferenceDto[];
  }
  </code></pre>
  
  <pre><code>import { IsString } from 'class-validator';
  
  export class ReferenceDto {
    @IsString()
    _id: string;
  
    @IsString()
    owner: string;
  }
  </code></pre>
  
  <p>build command:</p>
  
  <pre><code>cross-env NODE_ENV=development webpack --config ./config/webpack.config.dev.babel.js
  </code></pre>
  
  <p>webpack files:
  webpack.config.dev.babel.js</p>
  
  <pre><code>import merge from 'webpack-merge';
  import common from './webpack.config.common.babel';
  
  export default merge(common, {
    mode: 'development',
    devtool: 'source-map',
  });
  </code></pre>
  
  <p>webpack.config.common.babel.js:</p>
  
  <pre><code>import webpack from 'webpack';
  import { resolve } from 'path';
  import CopyWebpackPlugin from 'copy-webpack-plugin';
  import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin';
  
  export default {
    entry: './src/main.ts',
    target: 'node',
    optimization: {
      minimize: false,
      removeAvailableModules: false,
      removeEmptyChunks: false,
      splitChunks: false,
    },
    resolve: {
      extensions: ['.ts', '.js'],
      plugins: [new TsconfigPathsPlugin({ configFile: './tsconfig.build.json' })],
    },
    node: {
      __dirname: false,
      __filename: false,
    },
    externals: ['web3', 'pdf-parse'],
    stats: {
      // This is optional, but it hides noisey warnings
      warningsFilter: [
        'node_modules/express/lib/view.js',
        'node_modules/@nestjs/common/utils/load-package.util.js',
        'node_modules/@nestjs/core/helpers/load-adapter.js',
        'node_modules/optional/optional.js',
        'node_modules/@nestjs/core/helpers/optional-require.js',
        'node_modules/@nestjs/core/helpers/optional-require.js',
        (warning) =&gt; false,
      ],
    },
    output: {
      path: resolve(__dirname, '../dist'),
      filename: 'main.js',
      library: ['bootstrap'],
      libraryTarget: 'umd',
      umdNamedDefine: true,
    },
    module: {
      rules: [
        {
          enforce: 'pre',
          test: /\.(jsx?|tsx?)$/,
          exclude: /node_modules/,
          loader: 'eslint-loader',
        },
        {
          test: /\.ts$/,
          loader: 'ts-loader',
          include: resolve(__dirname, '../src'),
          options: {
            getCustomTransformers: (program) =&gt; ({
              before: [require('@nestjs/swagger/plugin').before({}, program)],
            }),
          },
        },
      ],
    },
    plugins: [
      new CopyWebpackPlugin([
        '../../node_modules/swagger-ui-dist/swagger-ui.css',
        '../../node_modules/swagger-ui-dist/swagger-ui-bundle.js',
        '../../node_modules/swagger-ui-dist/swagger-ui-standalone-preset.js',
        '../../node_modules/swagger-ui-dist/favicon-16x16.png',
        '../../node_modules/swagger-ui-dist/favicon-32x32.png',
      ]),
      new webpack.IgnorePlugin({
        /**
         * There is a small problem with Nest's idea of lazy require() calls,
         * Webpack tries to load these lazy imports that you may not be using,
         * so we must explicitly handle the issue.
         * Refer to: https://github.com/nestjs/nest/issues/1706
         */
        checkResource(resource) {
          const lazyImports = [
            '@nestjs/microservices',
            '@nestjs/platform-express',
            'cache-manager',
            'class-validator',
            'class-transformer',
            '@nestjs/microservices/microservices-module',
            '@nestjs/websockets/socket-module',
            'fastify-swagger',
          ];
          if (!lazyImports.includes(resource)) {
            return false;
          }
          try {
            require.resolve(resource);
          } catch (err) {
            return true;
          }
          return false;
        },
      }),
    ],
  };
  </code></pre>
  
  <p>maybe relevant dependencies:</p>
  
  <pre><code>    "tsconfig-paths-webpack-plugin": "^3.2.0",
      "typescript": "^3.8.3",
      "webpack": "^4.42.1",
      "webpack-cli": "^3.3.11",
      "webpack-dev-server": "^3.10.3",
      "webpack-merge": "^4.2.2"
  </code></pre>
  
  <p>I'm thankful for any help to fix this error.</p>