Skip to content

module: true does not provide all exports #13639

@guybedford

Description

@guybedford

Bug report

What is the current behavior?

A module like:

module.exports = 'test';

when running under the module: true mode will not export anything. Ideally module.exports should be treated as the default export surely.

In addition, a module like:

exports.valid = true;
exports['in valid'] = false;

would be expected to at least export export const valid = true but this does not seem to be the case.

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

A comprehensive replication can be provided if needed.

What is the expected behavior?

Ideally, a best effort can be made to export named exports as appropriate based on user intent.

Other relevant information:
webpack version: 5.36.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions