Skip to content

Types and implementation for constructor don't match #30

@ska-kialo

Description

@ska-kialo

When using a TypeScript checked CJS module require, TypeScript incorrectly complains with "This expression is not constructable."
During runtime this works as expected.

const ReactRefreshRspackPlugin = require('@rspack/plugin-react-refresh');

const instance = new ReactRefreshRspackPlugin();

Adding .default to the require silences the TypeScript error, but fails during runtime.
Using const { ReactRefreshRspackPlugin } = require('@rspack/plugin-react-refresh'); fails for both TypeScript and during runtime.

Note: happening since 1.4.0.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions