title: Path to node modules in webpack.config.js
body: <p>I have a project consisting of several apps and want to be able to build the complete project using a global webpack.config.js, with webpack 3.0 (which works). At the same time, I want to have local webpack.config.js files to build each project seperately. The project structure is as follows:</p>
  
  <pre><code>- src
    - project_1
      ...
      webpack.config.js
    ...
    - project_n
      ...
      webpack.config.js
    ...
    node_modules
    webpack.config.js
  </code></pre>
  
  <p>Obviously, I don't want to copy the node_modules in the project subfolders. How can I reference the global node_modules folder from the webpack.config.js of a project subfolder? </p>
  
  <p>I tried </p>
  
  <pre><code>resolve: {
      modules: [path.resolve(__dirname,'../node_modules')]
  },
  </code></pre>
  
  <p>in one of the subfolder webpack configs but I get many errors of the type</p>
  
  <blockquote>
    <p>error TS2304: Cannot find name [...]</p>
  </blockquote>
  
  <p>because apparently node_modules cannot be located. </p>
  
  <p>Here is my complete webpack.config.js for project_1:</p>
  
  <pre><code>var webpack = require('webpack');
  const path = require("path")
  
  module.exports =  {
      entry: path.resolve(__dirname, "src/project_1.ts"),
      output: {
          filename: "project_1_bundle.js",
          path:  path.resolve(__dirname, "bin")
      },
      externals: [
          "angular",
          "uuid",
          {
              "lodash": {
                  commonjs: "lodash",
                  amd: "lodash",
                  root: "_" // indicates global variable
              }
          },
          {
              "jquery": {
                  root: "$",
                  amd: "jquery",
                  commonjs: 'jquery'
              }
          },
          {
              "jquery-ui": {
                  amd: "jquery-ui",
                  commonjs: 'jquery-ui'
              }
          },
          {
              "Slick": {
                  root: "Slick",
                  amd: "Slick",
                  commonjs: 'Slick'
              }
          }
      ],
      devtool: 'source-map',
      resolve: {
      // Add `.ts` and `.tsx` as a resolvable extension.
      extensions: ['.webpack.js', '.web.js', '.ts', '.tsx', '.js'],
      modules: [path.resolve(__dirname,'../node_modules')]
      },
      module: {
          rules: [
              {
                  enforce: 'pre',
                  test: /\.ts$/,
                  use: ['tslint-loader']
              },
              {
                  test: /\.tsx?$/,
                  use: ['ts-loader']
              },
              {
                  test: /\.html$/,
                  use: ['html-loader']
              }
          ]
      }
  };
  </code></pre>