Skip to content

Conversation

@yaacovCR
Copy link
Contributor

@yaacovCR yaacovCR commented Jul 29, 2025

extracted from / based on:

Motivation:

This makes our build product cross-platform by dropping all Node.js specific code.

Differences:

  • the old PR drops esm support, this PR does not
  • the old PR uses import 'graphql/dev' to enable development mode on platforms that do not support setting custom conditions, while this PR uses: import { enableDevMode } from 'graphql'; enableDevMode()

From the docs included in this PR:

In development mode, GraphQL.JS can provides additional runtime check appropriate for development-time errors, including primarily the erroneous inclusion of multiple GraphQL.JS modules.

Unlike earlier versions of GraphQL.JS, by default, development mode is disabled. This is to best ensure that production builds do not incur the performance and bundle size penalties associated with the additional checks.

Also, unlike earlier versions, development mode is not configured by use of environment variables, which are accessed in disparate ways on the various platforms. In particular, the NODE_ENV environment variable now has no effect on triggering development mode. Rather, development mode is either enabled:

  1. explicitly, by calling enableDevMode() or
  2. implicitly, by setting the 'development' condition, which is possible only on platforms that support package.json conditional exports and custom conditions.

Conditional exports are supported by: Node.js, Deno (canary), Bun, Webpack 5, Rspack, Rollup (via the node-resolve plugin), esbuild, Vite, and Rsbuild. create-react-app and Next.js support conditional exports when using Webpack 5 as their bundler.

Conditional exports are not supported by Deno (current), Webpack 4, Rollup (without the node-resolve plugin), or swc. create-react-app and Next.js do not support conditional exports when using Webpack 4 as their bundler, nor does Next.js yet
support conditional exports when using Turbopack (see vercel/next.js#78912).

We encourage enabling development mode in a development environment, either explicitly or implicitly. This allows for an additional check to ensure that only a single GraphQL.JS module is used. Additional development-time checks may also be added in the future.

yaacovCR added a commit to yaacovCR/apollo-server that referenced this pull request Aug 18, 2025
use latest dev mode with dual build (see graphql/graphql-js#4464)
removes need for babel or swc
yaacovCR added a commit to yaacovCR/apollo-server that referenced this pull request Aug 18, 2025
use just config setting: testEnvironment / customExportConditions
use latest dev mode with dual build (see graphql/graphql-js#4464)
no need for additional transformer
yaacovCR added a commit to yaacovCR/apollo-server that referenced this pull request Aug 18, 2025
use just config setting: testEnvironment / customExportConditions
use latest dev mode with dual build (see graphql/graphql-js#4464)
no need for additional transformer
yaacovCR added a commit to yaacovCR/apollo-server that referenced this pull request Aug 18, 2025
use just config setting: testEnvironment / customExportConditions
use latest dev mode with dual build (see graphql/graphql-js#4464)
no need for additional transformer
yaacovCR added a commit to yaacovCR/apollo-server that referenced this pull request Aug 18, 2025
- use jest config setting: testEnvironment / customExportConditions
- use latest dev mode with dual build (see graphql/graphql-js#4464)
- no need for additional transformer
@yaacovCR
Copy link
Contributor Author

updated integration tests

thanks to @JoviDeCroock offline help, jest test working (demonstrated also at: apollographql/apollo-server#8137)

in terms of allowing switching back to prod mode, I still cannot reverse performance degradation in offline benchmarking even after 100,000 invocations of prod function, so will leave this simply as enableDevMode() which in general will not need to be called on any platform that supports custom conditions.

standardize deno call sites
remove unnecessary plugin
@yaacovCR yaacovCR added the PR: breaking change 💥 implementation requires increase of "major" version number label Aug 21, 2025
@yaacovCR yaacovCR merged commit 9e4f796 into graphql:next Aug 21, 2025
16 checks passed
@yaacovCR yaacovCR deleted the use-dev branch August 21, 2025 19:25
yaacovCR added a commit to yaacovCR/graphql-js that referenced this pull request Dec 17, 2025
…graphql#4464)

Motivation:

This PR makes our build product cross-platform by dropping all Node.js specific code.

In development mode, GraphQL.JS can provide an additional runtime check appropriate for development-time errors: the erroneous inclusion of multiple GraphQL.JS modules.

Unlike earlier versions of GraphQL.JS, by default, development mode is disabled. This is to best ensure that production builds do not incur the performance and bundle size penalties associated with the additional checks.

Also, unlike earlier versions, development mode is not configured by use of environment variables, which are accessed in disparate ways on the various platforms. In particular, the `NODE_ENV` environment variable now has no effect on triggering development mode. Rather, development mode is either enabled:
1. by setting a 'development' condition, which is possible only on platforms that support `package.json` conditional exports and custom conditions, or
2. by calling `enableDevMode()` within user code.

Conditional exports with custom conditions are supported by: Node.js, Deno, Bun, Webpack 5, Rspack, Rollup (via the `node-resolve` plugin), esbuild, Vite, and Rsbuild. create-react-app and Next.js support conditional exports when using Webpack 5 as their bundler.

Conditional exports with custom conditions are not supported by Webpack 4, Rollup (without the `node-resolve` plugin), older versions of Deno or transpilers such as swc. create-react-app and Next.js do not support conditional exports with custom conditions when using Webpack 4 as their bundler, nor does Next.js yet support conditional exports with custom conditions when using Turbopack (see vercel/next.js#78912).

Testing frameworks such as Mocha, Jest, and Vitest support conditional exports with custom conditions,

Integration tests within the repository demonstrate how to enable development mode using the `development` condition on various platforms that support this, as well as enabling development mode by calling `enableDevMode()` within user code.

We encourage enabling development mode in a development environment. This facilitates the additional check to ensure that only a single GraphQL.JS module is used. Additional development-time checks may also be added in the future.
yaacovCR added a commit to yaacovCR/graphql-js that referenced this pull request Dec 17, 2025
…graphql#4464)

Motivation:

This PR makes our build product cross-platform by dropping all Node.js specific code.

In development mode, GraphQL.JS can provide an additional runtime check appropriate for development-time errors: the erroneous inclusion of multiple GraphQL.JS modules.

Unlike earlier versions of GraphQL.JS, by default, development mode is disabled. This is to best ensure that production builds do not incur the performance and bundle size penalties associated with the additional checks.

Also, unlike earlier versions, development mode is not configured by use of environment variables, which are accessed in disparate ways on the various platforms. In particular, the `NODE_ENV` environment variable now has no effect on triggering development mode. Rather, development mode is either enabled:
1. by setting a 'development' condition, which is possible only on platforms that support `package.json` conditional exports and custom conditions, or
2. by calling `enableDevMode()` within user code.

Conditional exports with custom conditions are supported by: Node.js, Deno, Bun, Webpack 5, Rspack, Rollup (via the `node-resolve` plugin), esbuild, Vite, and Rsbuild. create-react-app and Next.js support conditional exports when using Webpack 5 as their bundler.

Conditional exports with custom conditions are not supported by Webpack 4, Rollup (without the `node-resolve` plugin), older versions of Deno or transpilers such as swc. create-react-app and Next.js do not support conditional exports with custom conditions when using Webpack 4 as their bundler, nor does Next.js yet support conditional exports with custom conditions when using Turbopack (see vercel/next.js#78912).

Testing frameworks such as Mocha, Jest, and Vitest support conditional exports with custom conditions,

Integration tests within the repository demonstrate how to enable development mode using the `development` condition on various platforms that support this, as well as enabling development mode by calling `enableDevMode()` within user code.

We encourage enabling development mode in a development environment. This facilitates the additional check to ensure that only a single GraphQL.JS module is used. Additional development-time checks may also be added in the future.
yaacovCR added a commit to yaacovCR/graphql-js that referenced this pull request Dec 17, 2025
…graphql#4464)

Motivation:

This PR makes our build product cross-platform by dropping all Node.js specific code.

In development mode, GraphQL.JS can provide an additional runtime check appropriate for development-time errors: the erroneous inclusion of multiple GraphQL.JS modules.

Unlike earlier versions of GraphQL.JS, by default, development mode is disabled. This is to best ensure that production builds do not incur the performance and bundle size penalties associated with the additional checks.

Also, unlike earlier versions, development mode is not configured by use of environment variables, which are accessed in disparate ways on the various platforms. In particular, the `NODE_ENV` environment variable now has no effect on triggering development mode. Rather, development mode is either enabled:
1. by setting a 'development' condition, which is possible only on platforms that support `package.json` conditional exports and custom conditions, or
2. by calling `enableDevMode()` within user code.

Conditional exports with custom conditions are supported by: Node.js, Deno, Bun, Webpack 5, Rspack, Rollup (via the `node-resolve` plugin), esbuild, Vite, and Rsbuild. create-react-app and Next.js support conditional exports when using Webpack 5 as their bundler.

Conditional exports with custom conditions are not supported by Webpack 4, Rollup (without the `node-resolve` plugin), older versions of Deno or transpilers such as swc. create-react-app and Next.js do not support conditional exports with custom conditions when using Webpack 4 as their bundler, nor does Next.js yet support conditional exports with custom conditions when using Turbopack (see vercel/next.js#78912).

Testing frameworks such as Mocha, Jest, and Vitest support conditional exports with custom conditions,

Integration tests within the repository demonstrate how to enable development mode using the `development` condition on various platforms that support this, as well as enabling development mode by calling `enableDevMode()` within user code.

We encourage enabling development mode in a development environment. This facilitates the additional check to ensure that only a single GraphQL.JS module is used. Additional development-time checks may also be added in the future.
yaacovCR added a commit to yaacovCR/graphql-js that referenced this pull request Dec 18, 2025
…graphql#4464)

Motivation:

This PR makes our build product cross-platform by dropping all Node.js specific code.

In development mode, GraphQL.JS can provide an additional runtime check appropriate for development-time errors: the erroneous inclusion of multiple GraphQL.JS modules.

Unlike earlier versions of GraphQL.JS, by default, development mode is disabled. This is to best ensure that production builds do not incur the performance and bundle size penalties associated with the additional checks.

Also, unlike earlier versions, development mode is not configured by use of environment variables, which are accessed in disparate ways on the various platforms. In particular, the `NODE_ENV` environment variable now has no effect on triggering development mode. Rather, development mode is either enabled:
1. by setting a 'development' condition, which is possible only on platforms that support `package.json` conditional exports and custom conditions, or
2. by calling `enableDevMode()` within user code.

Conditional exports with custom conditions are supported by: Node.js, Deno, Bun, Webpack 5, Rspack, Rollup (via the `node-resolve` plugin), esbuild, Vite, and Rsbuild. create-react-app and Next.js support conditional exports when using Webpack 5 as their bundler.

Conditional exports with custom conditions are not supported by Webpack 4, Rollup (without the `node-resolve` plugin), older versions of Deno or transpilers such as swc. create-react-app and Next.js do not support conditional exports with custom conditions when using Webpack 4 as their bundler, nor does Next.js yet support conditional exports with custom conditions when using Turbopack (see vercel/next.js#78912).

Testing frameworks such as Mocha, Jest, and Vitest support conditional exports with custom conditions,

Integration tests within the repository demonstrate how to enable development mode using the `development` condition on various platforms that support this, as well as enabling development mode by calling `enableDevMode()` within user code.

We encourage enabling development mode in a development environment. This facilitates the additional check to ensure that only a single GraphQL.JS module is used. Additional development-time checks may also be added in the future.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: breaking change 💥 implementation requires increase of "major" version number

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant