UNPKG
protobuf-json-loader
Version:
latest (1.0.4)
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
A protobuf loader module for webpack, transfer proto to json
protobuf-json-loader
/
index.js
13 lines
(9 loc)
•
297 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
var
protobuf =
require
(
'protobufjs'
);
function
protobufLoader
(
) {
var
callback =
this
.
async
(); protobuf.
load
(
this
.
resourcePath
,
function
(
err, root
) {
if
(err)
return
callback
(err);
callback
(
null
,
`module.exports =
${
JSON
.stringify(root)}
`
); }); }
module
.
exports
= protobufLoader;