{"id":48546,"library":"minify-graphql-loader","title":"minify-graphql-loader","description":"A webpack loader that minifies GraphQL queries, mutations and fragments by stripping whitespace and reducing query length before bundling. Version 1.0.2 is the latest stable release. The loader must be chained after graphql-tag/loader (or similar) to first transform .gql/.graphql files into JavaScript, then minify them. Key differentiator: reduces bundle size by an average of ~17.5% per query. Targeted at Node.js >=10.0.0. The project is relatively stable with a small maintenance footprint.","status":"active","version":"1.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/gabsprates/minify-graphql-loader","tags":["javascript","graphql","webpack","minify"],"install":[{"cmd":"npm install minify-graphql-loader","lang":"bash","label":"npm"},{"cmd":"yarn add minify-graphql-loader","lang":"bash","label":"yarn"},{"cmd":"pnpm add minify-graphql-loader","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Order matters: minify-graphql-loader must be the last loader in the use array (i.e., applied after graphql-tag/loader).","wrong":"module.exports = { module: { rules: [ { test: /\\.(graphql|gql)$/, use: ['minify-graphql-loader', 'graphql-tag/loader'] } ] } }","symbol":"minify-graphql-loader","correct":"module.exports = { module: { rules: [ { test: /\\.(graphql|gql)$/, use: ['graphql-tag/loader', 'minify-graphql-loader'] } ] } }"},{"note":"This is a webpack loader; it is not intended for direct import in application code. The loader is used in webpack config, not in source files.","wrong":"const loader = require('minify-graphql-loader')","symbol":"minify-graphql-loader","correct":"import loader from 'minify-graphql-loader'"},{"note":"graphql-tag/loader must come first because it transforms .graphql files into JavaScript. minify-graphql-loader then minifies the resulting code.","wrong":"use: ['minify-graphql-loader', 'graphql-tag/loader']","symbol":"graphql-tag/loader","correct":"use: ['graphql-tag/loader', 'minify-graphql-loader']"}],"quickstart":{"code":"// webpack.config.js\nconst path = require('path');\n\nmodule.exports = {\n  entry: './src/index.js',\n  output: {\n    path: path.resolve(__dirname, 'dist'),\n    filename: 'bundle.js',\n  },\n  module: {\n    rules: [\n      {\n        test: /\\.(graphql|gql)$/,\n        exclude: /node_modules/,\n        use: [\n          'graphql-tag/loader',\n          'minify-graphql-loader'\n        ]\n      }\n    ]\n  }\n};","lang":"javascript","description":"Webpack configuration using minify-graphql-loader in chain with graphql-tag/loader to minify GraphQL imports."},"warnings":[{"fix":"Ensure use array has 'graphql-tag/loader' first, then 'minify-graphql-loader'.","message":"Loader order is critical: minify-graphql-loader must be last in the loaders chain.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always pair with a GraphQL loader like graphql-tag/loader.","message":"Only supports webpack and requires a GraphQL loader to precede it; does not work standalone.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Install @types/graphql or use inline type declarations if needed.","message":"Does not provide TypeScript type definitions.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Consider forking or using alternative like babel-plugin-minify-graphql.","message":"Version 1.0.2 is the latest but may not be actively maintained; no updates since 2020.","severity":"gotcha","affected_versions":"1.0.2"}],"env_vars":null,"search_vec":"'/loader':40 '1.0.2':25 '10.0.0':68 '17.5':62 'averag':60 'bundl':23,56 'chain':35 'differenti':54 'file':47 'first':44 'footprint':78 'fragment':14 'gql/.graphql':46 'graphql':3,10,38,80 'graphql-tag':37 'javascript':49,79 'key':53 'latest':28 'length':21 'loader':4,7,32 'mainten':77 'minifi':2,9,51,82 'minify-graphql-load':1 'must':33 'mutat':12 'node.js':67 'per':63 'project':70 'queri':11,20,64 'reduc':19,55 'relat':72 'releas':30 'similar':42 'size':57 'small':76 'stabl':29,73 'strip':16 'tag':39 'target':65 'transform':45 'version':24 'webpack':6,81 'whitespac':17","created_at":"2026-06-07T16:57:12.341932+00:00","updated_at":"2026-06-07T16:57:12.341932+00:00","problems":[{"fix":"Add 'graphql-tag/loader' before 'minify-graphql-loader' in webpack rules.","cause":"Missing graphql-tag/loader before minify-graphql-loader or no GraphQL loader configured.","error":"Module parse failed: Unexpected token (1:6)\nYou may need an appropriate loader to handle this file type."},{"fix":"Run 'npm install --save-dev minify-graphql-loader' or 'yarn add --dev minify-graphql-loader'.","cause":"Package not installed or not listed in devDependencies.","error":"Error: Could not load loader: minify-graphql-loader"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/gabsprates/minify-graphql-loader#readme","github":"https://github.com/gabsprates/minify-graphql-loader","docs":null,"changelog":null,"pypi":null,"npm":"minify-graphql-loader","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}