Skip to content

pp-spaces/laravel-mix-graphql

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Laravel Mix GraphQL Extension

Downloads Release License

A Laravel Mix extension for GraphQL support for Webpack.

Installation

yarn add -D @pp-spaces/laravel-mix-graphql

or

npm install @pp-spaces/laravel-mix-graphql --save-dev

Laravel Mix Configuration

In your webpack.mix.js, import @pp-spaces/laravel-mix-graphql:

// webpack.mix.js

const mix = require("laravel-mix");

/**
 * Import laravel-mix-graphql
 */
require("@pp-spaces/laravel-mix-graphql");

/**
 * Register loader
 */
mix
  .js("resources/js/app.js", "public/js")
  .sass("resources/sass/app.scss", "public/css")
  .graphql();

Done!, re-run your compile command.

Usage

Within your project, e.g. app.js, you can import .graphql or .gql schema directly.

// app.js

import UserQuery from "./graphql/UserQuery.graphql";

Author

Socheat, Web Developer

Twitter Follow