A Vite plugin that enables importing .graphql and .gql files as JavaScript modules. Version 0.5.0, actively maintained with monthly releases. Key differentiator: it simply uses graphql-tag under the hood to compile queries to AST, making it lightweight and easy to use compared to heavier solutions like @graphql-tools/webpack-loader for webpack or the built-in Vite support for GraphQL files (which is experimental). No configuration needed beyond adding the plugin to vite.config.js.
npm install vite-plugin-simple-gqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to set up the plugin in vite.config.js and use it to import a .graphql file.
Ensure all .graphql imports are static imports at the top level of your modules.
Update vite.config.js to always call `gql()` as a function.
Install graphql-tag: npm install graphql-tag
Check that vite-plugin-simple-gql is added to the plugins array in vite.config.js and that the .graphql file is inside the project root.