{"id":48046,"library":"grpc-loader","title":"grpc-loader","description":"Webpack loader that converts .proto files into autogenerated JavaScript files for use with gRPC. Version 2.0.1 is the latest stable release; appears to be a maintenance-only project with no recent updates. Supports both static codegen (via google-protobuf) and dynamic codegen (via grpc.load). Requires peer dependencies: google-protobuf, grpc, protobufjs, and webpack 3.x. Differentiates by providing a straightforward webpack integration for gRPC proto files, though the API is considered verbose by the author.","status":"maintenance","version":"2.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/ashtonroute/grpc-loader","tags":["javascript","webpack","grpc","protobuf","proto","protocol","buffer"],"install":[{"cmd":"npm install grpc-loader","lang":"bash","label":"npm"},{"cmd":"yarn add grpc-loader","lang":"bash","label":"yarn"},{"cmd":"pnpm add grpc-loader","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency for static code generation","package":"google-protobuf","optional":true},{"reason":"peer dependency for dynamic code generation","package":"grpc","optional":false},{"reason":"peer dependency used by grpc dynamic loading","package":"protobufjs","optional":true},{"reason":"peer dependency as a webpack loader; v3.x required","package":"webpack","optional":false}],"imports":[{"note":"This is a webpack loader, not a regular module; it cannot be imported directly.","wrong":"import grpc from 'grpc-loader'","symbol":"grpc-loader","correct":"rules: [{ test: /\\.proto$/, loader: 'grpc-loader' }]"},{"note":"Webpack loaders are invoked on require() calls; ESM import may not trigger the loader depending on configuration.","wrong":"import proto from './test.proto';","symbol":"proxyquire or manual require","correct":"const proto = require('./test.proto');"},{"note":"The grpc package is a peer dependency; use CommonJS require to avoid issues with ESM interop.","wrong":"import grpc from 'grpc';","symbol":"grpc","correct":"const grpc = require('grpc');"}],"quickstart":{"code":"// webpack.config.js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.proto$/,\n        loader: 'grpc-loader',\n        options: {\n          static: true, // or false for dynamic\n          // convertFieldsToCamelCase: true,\n          // binaryAsBase64: false,\n          // longsAsStrings: true,\n          // enumsAsStrings: true,\n        },\n      },\n    ],\n  },\n};\n\n// In your code (when using static codegen)\nconst proto = require('./path/to/your.proto');\nconsole.log(proto.services); // { MyService: { ... } }\nconsole.log(proto.messages); // { MyMessage: { ... } }","lang":"javascript","description":"Configures webpack to load .proto files with grpc-loader and demonstrates usage with static code generation."},"warnings":[{"fix":"Use a different loader or upgrade webpack and migrate to @grpc/proto-loader or grpc-tools.","message":"Requires webpack 3.x - not compatible with webpack 4 or 5","severity":"breaking","affected_versions":"2.0.1"},{"fix":"Switch to @grpc/proto-loader and @grpc/grpc-js instead of using grpc-loader.","message":"The grpc npm package is deprecated in favor of @grpc/grpc-js","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Ensure you have exactly one version of each peer dep installed. Use --legacy-peer-deps if needed.","message":"Peer dependencies google-protobuf and protobufjs are optional but may cause unresolved version conflicts","severity":"gotcha","affected_versions":"<=2.0.1"},{"fix":"Do not attempt to import 'grpc-loader' in your source code; only reference it in webpack config.","message":"The loader must be specified in webpack rules, not as a direct import","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'2.0.1':19 '3':60 'api':75 'appear':25 'author':81 'autogener':11 'buffer':88 'codegen':40,47 'consid':77 'convert':7 'depend':52 'differenti':62 'dynam':46 'file':9,13,72 'googl':43,54 'google-protobuf':42,53 'grpc':2,17,56,70,84 'grpc-loader':1 'grpc.load':49 'integr':68 'javascript':12,82 'latest':22 'loader':3,5 'mainten':30 'maintenance-on':29 'peer':51 'project':32 'proto':8,71,86 'protobuf':44,55,85 'protobufj':57 'protocol':87 'provid':64 'recent':35 'releas':24 'requir':50 'stabl':23 'static':39 'straightforward':66 'support':37 'though':73 'updat':36 'use':15 'verbos':78 'version':18 'via':41,48 'webpack':4,59,67,83 'x':61","created_at":"2026-06-07T16:54:38.864896+00:00","updated_at":"2026-06-07T16:54:38.864896+00:00","problems":[{"fix":"Run npm install --save-dev grpc-loader (or yarn add --dev grpc-loader).","cause":"grpc-loader is not installed or webpack cannot find it in node_modules.","error":"Module not found: Error: Can't resolve 'grpc-loader'"},{"fix":"Install google-protobuf: npm install google-protobuf or yarn add google-protobuf.","cause":"Static code generation is enabled but google-protobuf peer dependency is missing.","error":"Error: Cannot find module 'google-protobuf'"},{"fix":"Install grpc: npm install grpc or yarn add grpc. Note: grpc is deprecated; consider switching to @grpc/grpc-js.","cause":"Dynamic code generation is enabled but grpc peer dependency is missing or not installed.","error":"Error: Cannot find module 'grpc'"}],"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/ashtonroute/grpc-loader#readme","github":"https://github.com/ashtonroute/grpc-loader","docs":null,"changelog":null,"pypi":null,"npm":"grpc-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}}