
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@graphox/babel-plugin
Advanced tools
Ensures GraphQL AST files are properly codesplit, preventing them from all ending up in the initial chunk.
Codegen already generates AST files at compile time. The problem is bundler behavior:
Without plugin:
Initial chunk: ALL generated AST files (~50KB+)
Lazy chunks: empty or minimal
With plugin:
Initial chunk: ~1KB (just imports)
Lazy chunks: each operation in its chunk
pnpm add --save-dev @graphox/babel-plugin
# graphox.yaml
output_dir: "__generated__"
projects:
- schema: "schema.graphql"
include: "src/**/*.{ts,tsx}"
pnpm graphox codegen
// babel.config.js
const path = require('path');
module.exports = {
presets: ['@babel/preset-typescript'],
plugins: [
['@graphox/babel-plugin', {
manifestPath: path.resolve(__dirname, '__generated__/manifest.json'),
outputDir: path.resolve(__dirname, '__generated__'),
graphqlImportPaths: ['@/graphql']
}]
]
};
Metro uses Babel transformers under the hood. Configure in metro.config.js:
// metro.config.js
module.exports = {
transformer: {
babelTransformerPath: require.resolve('@graphox/babel-plugin'),
},
};
For full compatibility, also configure in babel.config.js.
| Configuration | Initial Chunk | Per-Lazy-Chunk |
|---|---|---|
| Without plugin | ~50KB+ (all AST) | ~1KB |
| With plugin | ~1KB | ~1KB |
| Option | Type | Required | Description |
|---|---|---|---|
manifestPath | string | Yes* | Path to manifest.json generated by codegen |
manifestData | object[] | Yes* | Inline manifest data (alternative to manifestPath) |
outputDir | string | Yes | Directory containing generated files |
graphqlImportPaths | string[] | No | Explicit import paths to treat as GraphQL entrypoints |
emitExtensions | string | No | File extension for generated imports: "none" (default), "ts", "js", "dts" |
*Either manifestPath or manifestData is required.
Controls the file extension appended to generated import paths. Should match the emit_extensions setting in your graphox.yaml:
| Value | Result |
|---|---|
"none" (default) | import { X } from "./file.codegen" |
"ts" | import { X } from "./file.codegen.ts" |
"js" | import { X } from "./file.codegen.js" |
"dts" | import { X } from "./file.codegen.d.ts" |
When generate_ast_for_fragments: true is enabled in your config, fragment documents are also included in the manifest and will be properly rewritten by the plugin.
| Build Tool | Recommended Plugin |
|---|---|
| React Native (Metro) | Babel |
| Webpack | Babel |
| Create React App | Babel |
| Storybook | Babel |
| rsbuild | Use SWC plugin |
| Turbopack/Next.js | Use SWC plugin |
FAQs
Babel plugin for Graphox codesplitting
We found that @graphox/babel-plugin demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.