Skip to content

Add monaco-graphql/monaco-editor to the exports map#4264

Merged
trevor-scheer merged 6 commits into
graphql:mainfrom
trevor-scheer:trevor/monaco-graphql-exports
May 15, 2026
Merged

Add monaco-graphql/monaco-editor to the exports map#4264
trevor-scheer merged 6 commits into
graphql:mainfrom
trevor-scheer:trevor/monaco-graphql-exports

Conversation

@trevor-scheer
Copy link
Copy Markdown
Contributor

@trevor-scheer trevor-scheer commented May 14, 2026

Summary

  • Adds ./monaco-editor to monaco-graphql's exports map. It was previously only reachable via the unstable monaco-graphql/esm/monaco-editor path, which requires legacy node10 resolution.
  • Bumps the two monaco-graphql examples (nextjs, webpack) to TypeScript 5 and bundler resolution so they can adopt the canonical path.
  • Soft-deprecates the monaco-graphql/esm/* pattern in the README and changeset. The wildcard exports entry stays for backwards compatibility; removal is queued for the next major.
  • Unblocks adoption of the TypeScript Native Preview (tsgo): tsgo drops moduleResolution: "node", so any code relying on the wildcard-only monaco-graphql/esm/* path stops resolving once tsgo replaces tsc. The canonical subpath works under every modern resolution mode.

Validation Steps

  • yarn types:check: example-monaco-graphql-nextjs resolves the new path under bundler resolution.
  • yarn workspace example-monaco-graphql-webpack build: webpack resolves it through exports at runtime.

This re-exports `monaco-editor` with only the graphql and json
languages, skipping the css, html, and typescript contributions
that the default `monaco-editor` entry point bundles. Consumers
can use it to share a single `monaco-editor` instance with
`monaco-graphql` without paying for those extras.

Until now you had to reach for `monaco-graphql/esm/monaco-editor`,
which only resolves under legacy `node10`-style module resolution.

Also switches `@graphiql/react`'s `env.d.ts` augmentation re-exports
to the canonical path. Those are internal sources for `declare module`
blocks, not part of `@graphiql/react`'s public API.
`example-monaco-graphql-nextjs` and `example-monaco-graphql-webpack`
were on `typescript@^4` and `moduleResolution: "node"`, which doesn't
read package.json `exports`. Bump both to `typescript@^5`, switch to
`moduleResolution: "bundler"`, and update their imports to the
canonical `monaco-graphql/monaco-editor` and `monaco-graphql/initializeMode`
paths.

The Next.js example also moves off `target: "es5"` (matches the
sibling `example-graphiql-nextjs`) and drops the now-unnecessary
`baseUrl: "."`. `paths` resolves against the tsconfig location
automatically in TS 5+.
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 14, 2026

🦋 Changeset detected

Latest commit: 76c18fc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
monaco-graphql Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

The "Reduce Bundle Size" section and the accompanying ESLint rule
both still point at `monaco-graphql/esm/monaco-editor`. Switch them
to `monaco-graphql/monaco-editor`, matching the pattern already used
for `monaco-graphql/initializeMode` higher up in the README. The
legacy path still works for projects on legacy module resolution.
The `./*` wildcard in monaco-graphql's `exports` map exposes every
internal file in the package, including ones that were never intended
as public API. The genuinely public subpaths now all have canonical
entries: `monaco-graphql/monaco-editor`, `monaco-graphql/initializeMode`,
`monaco-graphql/graphql.worker`, and `monaco-graphql/lite`.

Mark the legacy `monaco-graphql/esm/*` pattern as deprecated in the
README and changeset. The wildcard stays in place so existing
consumers continue to work, but it is planned for removal in the
next major version.
@trevor-scheer trevor-scheer requested a review from dimaMachina May 14, 2026 18:30
@trevor-scheer trevor-scheer marked this pull request as ready for review May 14, 2026 18:31
@trevor-scheer trevor-scheer merged commit 227f5ba into graphql:main May 15, 2026
13 checks passed
@trevor-scheer trevor-scheer deleted the trevor/monaco-graphql-exports branch May 15, 2026 04:15
trevor-scheer pushed a commit that referenced this pull request May 15, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## monaco-graphql@1.8.0

### Minor Changes

- [#4264](#4264)
[`227f5ba`](227f5ba)
Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Add
`./monaco-editor` to the `exports` map.

`monaco-graphql/monaco-editor` re-exports `monaco-editor` with only the
graphql and json languages, skipping the css, html, and typescript
contributions that the default `monaco-editor` entry point bundles.
Consumers can use it to share a single `monaco-editor` instance with
`monaco-graphql` (for `editor`, `Uri`, `KeyMod`, `KeyCode`, `languages`,
etc.) without paying for those extras. Until now you had to reach for
the unstable `monaco-graphql/esm/monaco-editor` path, which only
resolves under legacy `node10`-style module resolution.

The legacy `monaco-graphql/esm/monaco-editor` path still works via the
existing `./*` wildcard, so this change is purely additive.

The `monaco-graphql/esm/*` import pattern is now considered deprecated.
It will continue to work throughout the `1.x` line, but the wildcard
`exports` entry that enables it is planned for removal in the next major
version. New code should prefer the canonical paths:
`monaco-graphql/monaco-editor`, `monaco-graphql/initializeMode`,
`monaco-graphql/graphql.worker`, and `monaco-graphql/lite`.

## codemirror-graphql@2.2.6

### Patch Changes

- [#4274](#4274)
[`d23f3b1`](d23f3b1)
Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Bump
TypeScript emit target from `es5` to `es6`.

The published JavaScript now uses ES6 syntax (`const`, arrow functions,
native destructuring) instead of down-leveled ES5. In practice this is
consumed via a bundler in every real-world setup (and paired with
CodeMirror 5, which already requires an ES6 runtime), so this changes
the intermediate emit but not what consumers end up shipping. Code that
loads the published `.js` directly in a strictly ES5-only environment
(e.g. IE11 without transpilation) is no longer supported. CodeMirror 5
itself does not support that configuration.

## @graphiql/react@0.37.5

### Patch Changes

- [#4232](#4232)
[`3934e4a`](3934e4a)
Thanks [@simmerer](https://github.com/simmerer)! - Bugfix for multiline
selection highlight styling: disabling Monaco's `roundedSelection`
option prevents selection highlight from appearing to extend beyond
actual text selection. See issue
[#4094](#4094).

- Updated dependencies
\[[`227f5ba`](227f5ba)]:
    -   monaco-graphql@1.8.0

## vscode-graphql@0.13.5

### Patch Changes

- [#4267](#4267)
[`e4f5148`](e4f5148)
Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Burning
patch version due to previous release failure.

## vscode-graphql-execution@0.3.5

### Patch Changes

- [#4267](#4267)
[`e4f5148`](e4f5148)
Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Burning
patch version due to previous release failure.

## vscode-graphql-syntax@1.3.11

### Patch Changes

- [#4267](#4267)
[`e4f5148`](e4f5148)
Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Burning
patch version due to previous release failure.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

1 participant