Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rollup/plugin-graphql

Package Overview
Dependencies
Maintainers
4
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rollup/plugin-graphql

Convert .gql/.graphql files to ES6 modules

  • 2.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
187K
increased by2.84%
Maintainers
4
Weekly downloads
 
Created

What is @rollup/plugin-graphql?

@rollup/plugin-graphql is a Rollup plugin that allows you to import GraphQL files into your JavaScript or TypeScript projects. This can be particularly useful for bundling GraphQL schema or query files directly into your application, making it easier to manage and deploy GraphQL-related code.

What are @rollup/plugin-graphql's main functionalities?

Import GraphQL Files

This feature allows you to import GraphQL files directly into your JavaScript or TypeScript code. The imported schema or query can then be used within your application.

import schema from './schema.graphql';

console.log(schema);

Bundling GraphQL Files

This feature demonstrates how to use the @rollup/plugin-graphql to bundle GraphQL files along with your JavaScript code using Rollup. The plugin processes the GraphQL files and includes them in the final bundle.

import { rollup } from 'rollup';
import graphql from '@rollup/plugin-graphql';

const inputOptions = {
  input: 'src/index.js',
  plugins: [graphql()]
};
const outputOptions = {
  file: 'bundle.js',
  format: 'cjs'
};

async function build() {
  const bundle = await rollup(inputOptions);
  await bundle.write(outputOptions);
}

build();

Other packages similar to @rollup/plugin-graphql

Keywords

FAQs

Package last updated on 09 Oct 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc