Easily import [.graphql
] and [.gql
] files using Vite
.
npm i vite-plugin-simple-gql -D
# yarn add vite-plugin-simple-gql -D
add this plugin to vite.config.js
import { defineConfig } from 'vite';
import gql from 'vite-plugin-simple-gql';
export default defineConfig({
plugins: [gql()]
});
import your graphql
files
import MyQuery from './queries/MyQuery.graphql'
MIT