1.0.0 • Published 2 years ago

vite-plugin-proto v1.0.0

Weekly downloads
-
License
GPL-3.0
Repository
github
Last release
2 years ago

vite-plugin-proto

npm

Allows you to import proto files as a parsed object directly in your code, uses protobufjs under the hood.

import grpc from '@grpc/grpc-js';
import protoLoader from '@grpc/proto-loader';

import greeterNamespace from './proto/greeter.proto';

const packageDefinition = protoLoader.fromJSON(greeterNamespace);
const packageObject = grpc.loadPackageDefinition(packageDefinition);

Usage

import proto from 'vite-plugin-proto';

export default {
  plugins: [
    proto(),
  ]
}

Options

OptionTypeDefaultDescription
basePathstring./The base path that will be used to resolve other .proto files in import statements, useless if you define resolvePath
resolvePath(origin: string, target: string) => string(_, target) => path.resolve(basePath, target)A function that will be used to resolve other .proto files in import statements
parseOptionsimport('protobufjs').IParseOptionsundefinedOptions that will be passed to protobufjs's load method
1.0.0

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago