diff --git a/README.md b/README.md index 1809683..b3c3c34 100644 --- a/README.md +++ b/README.md @@ -3,31 +3,33 @@ 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 +```sh +npm install proto-loader --save-dev +``` ## Usage [Documentation: Using loaders](http://webpack.github.io/docs/using-loaders.html) -``` javascript +```js /* 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'); +const ProtoBuf = require('protobufjs/dist/protobuf-light'); -var protoDefinition = require('proto!./message.proto'); +const protoDefinition = require('proto!./message.proto'); // => returns object converted from message.proto, resolves imports -var builder = ProtoBuf.loadJson(protoDefinition); +const builder = ProtoBuf.loadJson(protoDefinition); //... ``` ### webpack config -``` javascript +```js module.exports = { module: { loaders: [