protobuf-json-webpack-plugin
v1.1.1
Published
compile protobufjs struct file to js file
Downloads
1
Readme
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)