Skip to content

Conversation

Septh
Copy link

@Septh Septh commented Sep 4, 2025

Rollup Plugin Name: {name}

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no - read on! :)

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

If yes, then include "BREAKING CHANGES:" in the first commit message body, followed by a description of what is breaking.

List any relevant issue numbers:

Fixes #1541, #1578
Supersedes #1744, #1782

Description

Since #1782 is still failing in CI and since I still have no idea how to fix it, this new PR is a shameful attempt to work around the issue by providing named exports for all plugins, in addition to the default export.

// ❌ fails with `type="module"` and `moduleResolution="node16"`
import typescript from '@rollup/plugin-typescript'

// ✅ works everywhere
import { typescript } from '@rollup/plugin-typescript'

I've also added a note in each README.md, right below the usage example, that reads like this:

Note

If your editor complains that "XXX is not a function", then use the named export instead:

import { XXX } from '@rollup/plugin-XXX';

Because there is absolutely no code change except for an additional export of the main factory function, I don't think new tests are necessary here. Please let me know if you feel otherwise.

@shellscape
Copy link
Collaborator

Appreciate the additional effort here, but we need a different direction so we're not dealing with bandaids.

Node 20.19.0 released proper compatibility for importing/requiring EMS from CJS. Now that Node 18 is out of LTS, we can safely enforce Node 20.19.0 as the minimum version. That means there's no reason for this repo to ship support for both CJS and ESM anymore.

What the project needs is for every plugin to be authored in TS and updated to ship only ESM. That should nuke any TS compat issues as well as bring the repo up to date. (For what it's worth, this is also something that needs to happen on a per-package basis, not a single PR that updates the world at once)

@Septh
Copy link
Author

Septh commented Sep 4, 2025

Well, I tried 😅

Agreed, this is the way to go. Any ETA about this? Do you need any help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't correctly import plugins into a TypeScript module
2 participants