Skip to content

pp-spaces/laravel-mix-graphql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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