Skip to content

Enable esModule by default #485

Closed
Closed
@edmorley

Description

@edmorley
  • Operating System: N/A
  • Node Version: N/A
  • NPM Version: N/A
  • webpack Version: 4
  • mini-css-extract-plugin Version: 0.9.0

Expected Behavior / Situation

The esModule option is enabled by default.

Actual Behavior / Situation

The esModule option is not enabled by default.

Modification Proposal

In #475 a new esModule loader option was added, which causes the loader part of mini-css-extract-plugin to output ES Module style syntax instead of CJS (docs).

Currently the feature is disabled by default, and to gain the benefits (eg improved tree shaking), people have to enable it explicitly by setting it to true.

I propose enabling it by default, so that:

  1. People don't have to know about the feature to gain the benefits (not everyone will read about it/understand the benefits)
  2. Reduce the amount of webpack config boilerplate when using mini-css-extract-plugin

Since webpack 4 already natively supports ES Modules, and mini-css-extract-plugin only supports webpack 4 or newer, it seems this could land as a feature change rather than a breaking change, though I'd be fine with either, so long as we can enable it by default :-)

Metadata

Metadata

Assignees

No one assigned

    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