Webpack Missing Module 'Module Not Found'

The problem with ignore plugin on node_modules. In webpack.config.js, you have:

var ignore = new webpack.IgnorePlugin(new RegExp("/(node_modules|ckeditor)/"))
...
plugins: [
  ignore,
],

From Ignore Plugin documentation:

Don’t generate modules for requests matching the provided RegExp.

Webpack tries to require module with the name node_modules/process/browser for React module and fails with it because it is ignored.

Try to remove node_modules from Ignore Plugin or write less global condition if you really need this.


Importing nodeExternals worked for me.

import nodeExternals from 'webpack-node-externals';

this is my server.webpack.config:

import path from 'path';
import nodeExternals from 'webpack-node-externals'; // changes

const CONTEXT = path.join( __dirname, "../.." ),
  INPUT_SERVER_DIR = path.join( CONTEXT, "server" ),
  OUTPUT_SERVER_DIR = path.join( CONTEXT, "dist/server" );

export default [
  {
    name: 'server',
    target:  'node',
    context: INPUT_SERVER_DIR,
    node: {
      __dirname: false
    },
    entry: './server',
    devtool : 'source-map',
    output: {
      path: OUTPUT_SERVER_DIR,
      filename: "server.js"
    },
    module: {
      rules: [
        {
          test: /\.js$/,
          exclude: /node_modules/,
          loader: "babel-loader"
        }
      ]
    },
    resolve: {
      extensions: ['.js']
    },
    **externals : [ nodeExternals() ]**
  }
];