Registry / esbuild-relay-plugin

esbuild-relay-plugin

JSON →
library1.0.0jsnpmunverified

An esbuild plugin that transforms tagged GraphQL template literals for Relay by replacing `graphql` tagged templates with imports to the artifacts generated by `relay-compiler`. Version 1.0.0 is stable but uses naive string replacement rather than AST parsing, so it will attempt to compile even commented-out GraphQL literals. It supports both CommonJS and ESM module formats and is inspired by babel-plugin-relay, but with a simpler, faster approach for esbuild users. Release cadence is low; not actively maintained.

Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ESM-only; named export, not default.

import { EsbuildRelayPlugin } from 'esbuild-relay-plugin'

esbuild itself is also ESM-only. Use dynamic import or ESM context.

import esbuild from 'esbuild'

Shows basic usage of esbuild-relay-plugin with esbuild, specifying artifact directory and TypeScript language.

import esbuild from 'esbuild'; import { EsbuildRelayPlugin } from 'esbuild-relay-plugin'; await esbuild.build({ entryPoints: ['src/index.ts'], bundle: true, outfile: 'dist/index.js', plugins: [ new EsbuildRelayPlugin({ artifactDirectory: '__generated__', language: 'typescript' }) ] });
Debug
Known footguns
gotchaPlugin uses string replacement and does not parse source code; it will replace `graphql` tagged templates even inside comments, potentially causing errors.
deprecatedRequires relay-compiler to be run separately; no automatic artifact generation.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
10 hits · last 30 days
gptbot
3
ahrefsbot
3
claudebot
3
bingbot
1
Resources