
Product
A Fresh Look for the Socket Dashboard
We’ve redesigned the Socket dashboard with simpler navigation, less visual clutter, and a cleaner UI that highlights what really matters.
vite-plugin-graphql-strings
Advanced tools
Based on vite-plugin-graphql, but somewhat simpler. I prefer simple strings for my queries. This versions has a lot of limitation and probably isn't what you are looking for.
While it isn't hard to get strings from a .graphql file by looking for empty lines, this plugin combines the fragments with your query, as long as the fragments are found in the same document.
npm i vite-plugin-graphql-strings
const graphqlPlugin = require('vite-plugin-graphql-strings')
const config = {
plugins: [
graphqlStringsPlugin({
exportUpperCase: true, // default
}),
],
}
When exportToUpperCase
the query names conventionally written in PascalCase like GetAllPosts
will be converted to uppercase as is the convention for Javascript constants resulting in GET_ALL_POSTS
with the previous example.
Now all the files ends with .gql
or .graphql
will be handled by vite-plugin-graphql-strings
.
import { SomeAmazingQuery } from './queries.graphql'
That will be a simple string representing the query object. Your queries can be in separate files or a single queries.graphql, but because the queries are processed into strings at compile time, they cannot import from other documents, so #import
will be ignored.
FAQs
a Vite plugin for loading GraphQL files as strings
The npm package vite-plugin-graphql-strings receives a total of 21 weekly downloads. As such, vite-plugin-graphql-strings popularity was classified as not popular.
We found that vite-plugin-graphql-strings demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Product
We’ve redesigned the Socket dashboard with simpler navigation, less visual clutter, and a cleaner UI that highlights what really matters.
Industry Insights
Terry O’Daniel, Head of Security at Amplitude, shares insights on building high-impact security teams, aligning with engineering, and why AI gives defenders a fighting chance.
Security News
MCP spec updated with structured tool output, stronger OAuth 2.1 security, resource indicators, and protocol cleanups for safer, more reliable AI workflows.