# proto-loader

> Protocol Buffer loader module for webpack

Latest version **0.2.0** (published 2015-12-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install proto-loader
pnpm add proto-loader
yarn add proto-loader
bun add proto-loader
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2015-12-15 |
| First published | 2015-12-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 27 |
| Author | Brian Chirls @bchirls |
| Maintainers | brianchirls |
| Keywords | webpack, protobuf, proto, protocol, buffer |

## Links

- npm: https://www.npmjs.com/package/proto-loader
- Repository: https://github.com/brianchirls/proto-loader
- Homepage: https://github.com/brianchirls/proto-loader#readme
- Issues: https://github.com/brianchirls/proto-loader/issues
- npm.io page: https://npm.io/package/proto-loader

## Dependencies (1)

- [loader-utils](https://npm.io/package/loader-utils.md) ^0.2.11

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads
- [datasets-fi-postalcodes](https://npm.io/package/datasets-fi-postalcodes.md) — 1.1K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2015-12-15
- 0.1.0 — 2015-12-15

## README

# Protocol Buffer loader module for webpack

Converts .proto files into JSON so they can be [loaded without a parser](https://github.com/dcodeIO/ProtoBuf.js/wiki/Builder#using-json-without-the-proto-parser). For use with [webpack](http://webpack.github.io/docs/) and [ProtoBuf.js](https://github.com/dcodeIO/ProtoBuf.js)

## Installation
npm install proto-loader

## Usage

[Documentation: Using loaders](http://webpack.github.io/docs/using-loaders.html)

``` javascript
/*
protobufjs has a light build that does not include code for parsing .proto
files. The extra code is not typically necessary if you're using this loader,
but if you still need it, you can change the below line to:
var ProtoBuf = require('protobufjs');
*/
var ProtoBuf = require('protobufjs/dist/protobuf-light');

var protoDefinition = require('proto!./message.proto');
// => returns object converted from message.proto, resolves imports

var builder = ProtoBuf.loadJson(protoDefinition);
//...
```

### webpack config

``` javascript
module.exports = {
  module: {
    loaders: [
      {
        test: /\.proto$/,
        loader: "proto-loader"
      }
    ]
  }
};
```

Then you only need to write: `require("./message.proto")`


## License
MIT (http://www.opensource.org/licenses/mit-license.php)

---
_Source: https://npm.io/package/proto-loader · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
