Giter Club home page Giter Club logo

akita-graphql-book's Introduction

Angular CLI custom webpack config ๐ŸŽ‰

  1. Install plugin webpack-notifier
  • npm install webpack-notifier

  • Create webpack.config.js file and add content bellow into:
const WebpackNotifierPlugin = require('webpack-notifier');
const path = require('path');

module.exports = {
  resolve: {
    extensions: ['.ts', '.tsx', '.js', '.jsx', '.scss', '.gql', '.graphql'],
    modules: [path.resolve(__dirname), 'node_modules']
  },
  module: {
    rules: [
      {
        test: /\.(graphql|gql)$/,
        exclude: /node_modules/,
        loader: 'graphql-tag/loader'
      }
    ]
  },
  plugins: [
    new WebpackNotifierPlugin({
      alwaysNotify: true,
      title: 'Akita'
    })
  ]
};
  1. Installation and configuration
  • Link github for guide ๐Ÿš€ ๐Ÿš€ ๐Ÿš€

  • npm install @angular-builders/custom-webpack

  • Inside angular.json file

"serve": {
    "builder": "@angular-builders/custom-webpack:dev-server",
    "options": {
    "browserTarget": "my-app:build",
    "customWebpackConfig": {
        "path": "./webpack.config.js"
    }
    },
    "configurations": {
    "production": {
        "browserTarget": "my-app:build:production"
    }
    }
},
  • This is a content when start with dev mode. Insted, if you want use with pro mode, please do the same as above (dev) mode
  1. Create @types folder and graphql.d.ts file, and add content bellow into:
declare module '*.graphql' {
  import { DocumentNode } from 'graphql';
  const value: {
    [key: string]: DocumentNode;
  };
  export = value;
}

This enables us to import graphql files, which is used to communicate with the graphql server

akita-graphql-book's People

Contributors

ngtrdai197 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.