Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Unable to use with webpack w/ react-app-rewired #1

@itseasy21

Description

@itseasy21

Thanks for this awesome lib.

I'm unfortunately not able to use it inside the react-app-rewired config while extending the webpack plugins. When added it ends up with the following error:

C:\Workspace\xxxxx\xxxxx\xxxxx\xxxxx\xxxxx\config-overrides.js:12
    require('unplugin-clear-testid/webpack')({
                                            ^
TypeError: require(...) is not a function
    at Object.override [as webpack] (C:\Workspace\xxxxx\xxxxx\xxxxx\xxxxx\xxxxx\config-overrides.js:12:45)

The plugins array is:

module.exports = function override(config, env) {
  config.plugins = [
    ...config.plugins,
    new ProvidePlugin({
      React: 'react',
      'ReactDOM': 'react-dom',
    }),
    require('unplugin-clear-testid/webpack')({
      attrs: ['data-testid', 'data-cy'],
      testing: process.env.NODE_ENV === 'testing'
    })
  ];
  return rewiredEsbuild()(config, env);
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions