protobuf-json-webpack-plugin

1.1.1 • Public • Published

protobuf-json-webpack-plugin

protobuf compile to json file

install

  npm install protobuf-json-webpack-plugin --save-dev

webpack config

const Proto2JsonPlugin = require('protobuf-json-webpack-plugin')


plugins: [
  new Proto2JsonPlugin(
    inputs: ['/a/b/c.proto', '/a/c/*.proto'],
    output: '/a/b/c/xxxx.js'
  )
]

js call

const struct = require('${output js file path}')
const yyyy = struct.lookupType('xxx.Yyyy')
const jsData = yyyy.decode(data)

Readme

Keywords

none

Package Sidebar

Install

npm i protobuf-json-webpack-plugin

Weekly Downloads

3

Version

1.1.1

License

ISC

Unpacked Size

1.99 kB

Total Files

3

Last publish

Collaborators

  • zhangshaolongjj