Skip to content

Add named exports for all plugins #360

@NotWoods

Description

@NotWoods
  • Rollup Plugin Name: all plugins except for node-resolve and babel

Feature Use Case

Using the default export creates issues with CommonJS if we want to export more than one item. When using @rollup/plugin-babel, the different import styles look like:

import babel from '@rollup/plugin-babel';
const babel = require('@rollup/plugin-babel').default;

In contrast, the named exports look more similar:

import { babel } from '@rollup/plugin-babel';
const { babel } = require('@rollup/plugin-babel');

Note: both formats work today because we export the plugin under babel and default.

Feature Proposal

As soon as we add any additional exports to a module, as was the case for @rollup/plugin-node-resolve, we need to use named exports. I think we should switch to named exports for all plugins for consistency. We can continue to export default as well for the ES module import format, but CJS outputs would have breaking changes.

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