Webpack 4.10.0 destroys production build

Bug report

What is the current behavior?
Uncaught TypeError: Cannot read property 'call' of undefined
in different projects, only in production build, only after update from 4.9.2 to 4.10.0

If the current behavior is a bug, please provide the steps to reproduce.

What is the expected behavior?
not error

Other relevant information:
webpack version: 4.10.0
Node.js version: 10.1.0
Operating System: Windows and Linux
Additional tools: –

in webpack.build.js:

const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const merge = require('webpack-merge');
const Webpack = require('webpack');
const CompressionPlugin = require('compression-webpack-plugin');

const config = require('./config');

const publicPath = process.env.npm_package_config_public_path;

module.exports = merge(config, {
  module: {
    rules: [
      {
        test: /\.js$/,
        use: ['babel-loader'],
        exclude: /node_modules/,
      },
      {
        test: /\.s?css$/,
        use: [
          MiniCssExtractPlugin.loader,
          'css-loader',
          'postcss-loader',
          'sass-loader',
        ]
      }
    ],
  },
  mode: 'production',
  output: {
    filename: '[name].[chunkhash].js',
    chunkFilename: '[name].[chunkhash].chunk.js',
    publicPath: publicPath,
  },
  optimization: {
    splitChunks: {
      cacheGroups: {
        vendor: {
          test: /node_modules/,
          name: 'vendor',
          chunks: 'initial',
          enforce: true
        }
      }
    },
    minimize: true,
    runtimeChunk: {
      name: 'vendor'
    }
  },
  plugins: [
    new MiniCssExtractPlugin({
      filename: '[name].[chunkhash].css',
      chunkFilename: '[name].[chunkhash].css'
    })
  ],
});

Author: Fantashit

10 thoughts on “Webpack 4.10.0 destroys production build

  1. I have problem with production build, too.
    4.10.0 and 4.10.1 fails with the following:

    ERROR in chunk about-us
    assets/276.2732141f9c704103bdef.css
    /home/milosz/ivyspace/ivyspace-frontend/node_modules/babel-loader/lib/index.js??ref--4!/home/milosz/ivyspace/ivyspace-frontend/frontend/scripts/features/public/aboutUs/components/Details.js
    RuntimeTemplate.moduleId(): Module /home/milosz/ivyspace/ivyspace-frontend/node_modules/lodash-es/camelCase.js has no id. This should not happen.
    
    ERROR in chunk app [entry]
    assets/app.2732141f9c704103bdef.css
    /home/milosz/ivyspace/ivyspace-frontend/node_modules/babel-loader/lib/index.js??ref--4!/home/milosz/ivyspace/ivyspace-frontend/frontend/scripts/features/common/components/ScreenSizeManager.js
    RuntimeTemplate.moduleId(): Module /home/milosz/ivyspace/ivyspace-frontend/node_modules/lodash-es/debounce.js has no id. This should not happen.
    

    4.9.2 builds fine.

  2. we’re also experiencing this issue. webpack 4.10.1

    ERROR in chunk client [entry]
        [name].[chunkhash:8].js
        /.../node_modules/babel-loader/lib/index.js??ref--4!/.../src/modules/users.js
        RuntimeTemplate.moduleId(): Module /.../node_modules/redux-form/es/SubmissionError.js has no id. This should not happen.
    

    changing mode to ‘development’ in webpack.config.js resolves the issue, so is definitely related to production mode.

    Any steps we can take to help debug, please let me know, and I can contribute updates to this issue.

  3. I can confirm that an issue still exists in 4.10.2. I’m getting Unhandled promise rejection TypeError: Cannot read property 'call' of undefined when building in production with 4.10.2. 4.9.2 works fine.

  4. @evilebottnawi I cant seem to be able to reproduce it in a minimal repo, but the full stack trace is as follows:

    Unhandled promise rejection TypeError: Cannot read property 'call' of undefined
        at o (bootstrap:81)
        at Object.288 (immutable.js:37)
        at o (bootstrap:81)
        at Object.313 (formWarning.js:41)
        at o (bootstrap:81)
        at Object.522 (formActions.js:44)
        at o (bootstrap:81)
        at Module.<anonymous> (cc78b3ce504028caff47.js:1)
        at Module.296 (rollout.js:13)
        at o (bootstrap:81)
        at .*\.js$ namespace object:168
        at a (es6.promise.js:75)
        at es6.promise.js:92
        at MutationObserver.c (_microtask.js:18)
    

    It seems to crash when trying to import something that is re-exported from redux-form. The relevant source file in redux form is here: https://github.com/erikras/redux-form/blob/master/src/immutable.js

  5. This issue got a bit confusing, some reporting it fixed, some reporting broken. I closed this now as the original poster reports it fixed. If you still have the issue, please open a new issue with stack trace and repro repo.

Comments are closed.