Skip to content
This repository was archived by the owner on Feb 4, 2026. It is now read-only.
This repository was archived by the owner on Feb 4, 2026. It is now read-only.

Error when trying to use WebpackReactComponentNamePlugin #33

@omprakashyadav

Description

@omprakashyadav

Hello Everyone,

I am using NextJS 12 for my application and now wanted to use reflect.run for all my automation testing.
I am getting the following error, when the webpack-react-component-name dependency is added to the package.json.

> Build error occurred
Error: Cannot find module 'webpack/lib/dependencies/NullDependency'
Require stack:
- /Users/om/Evolphin/github/pico-web-application/node_modules/webpack-react-component-name/lib/module-appender.js
- /Users/om/Evolphin/github/pico-web-application/node_modules/webpack-react-component-name/index.js
- /Users/om/Evolphin/github/pico-web-application/next.config.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15)
    at Function.mod._resolveFilename (/Users/om/Evolphin/github/pico-web-application/node_modules/next/dist/build/webpack/require-hook.js:183:28)
    at Function.Module._load (node:internal/modules/cjs/loader:804:27)
    at Module.require (node:internal/modules/cjs/loader:1028:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/Users/om/Evolphin/github/pico-web-application/node_modules/webpack-react-component-name/lib/module-appender.js:1:24)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
    at Module.load (node:internal/modules/cjs/loader:1004:32)
    at Function.Module._load (node:internal/modules/cjs/loader:839:12) {
  code: 'MODULE_NOT_FOUND',

Here is my entry in package.json:
-> "webpack-react-component-name": "^5.0.5"

Here is how I have included it in my next.config.js

webpack: config => {
    // Alias
    config.resolve.alias["~"] = path.resolve(__dirname + "/src");

    // Svgr
    config.module.rules.push({
      test: /\.svg$/i,
      issuer: /\.[jt]sx?$/,
      use: ["@svgr/webpack"]
    });
    config.plugins.push(new WebpackReactComponentNamePlugin());
    return config;
  }

Can someone help, how to resolve this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions