ci: rename rollup configs to .mjs for Node 18 compatibility#5
Merged
Conversation
…lity CI on Node 18 fails because each packages/*/rollup.config.js uses ESM import syntax but no package.json declares "type": "module" and the file extension is .js. Node 20+ transparently detects the ESM and reparses as a module (the behavior we were relying on locally); Node 18 throws SyntaxError: Cannot use import statement outside a module. Rename all 9 rollup configs from .js to .mjs, which is the canonical way to mark a config file as ESM without forcing the whole package to be type:module. No package.json or source changes needed. Verified locally: `npm run build --workspaces` still builds all 9 packages, and `npx vitest run` still reports 1082/1082 tests passing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the Node 18 matrix cell in `.github/workflows/ci.yml`, which errored out at the `Build all workspace packages` step with:
```
SyntaxError: Cannot use import statement outside a module
/home/runner/.../packages/types/rollup.config.js:1
import typescript from '@rollup/plugin-typescript';
```
Node 20+ transparently detects that the rollup config uses ESM and reparses it as a module. Node 18 does not — a `.js` file must either have `"type": "module"` in a nearby `package.json` or be renamed to `.mjs`.
Renaming to `.mjs` is the minimum-surface fix: no `package.json` changes, no source changes, just 9 file renames.
Test plan
This PR just flips the extension; expected result in CI is Node 18 / 20 / 22 all green and the `build-artifact` job running through.