Giter VIP home page Giter VIP logo

Comments (1)

jonnyreeves avatar jonnyreeves commented on May 25, 2024

Sorry for the slow response @graywolf336, this implementation (adding the .js file extension to the require() statement) is consistent with the protoc javascript generator's output. If you clone this project and run:

npm i && cd test && npm run build

You will see that the test/js_test/generated/examplecom/simple_pb.js file (which is generated by protoc) contains the following require() statements which include the .js file extension:

var google_protobuf_compiler_plugin_pb = require('google-protobuf/google/protobuf/compiler/plugin_pb.js');

Whilst we do have control over the contents of the generated _pb_service.js files, and could strip the .js extension from there, we would not be able to modify the output from protoc - unless there is a protoc flag that I'm not aware of that modifies this behaviour?

As a workaround I would suggest running a post-processor over your generated files and stripping the .js extension using something like sed.

FWIW using require() with a .js file extension is valid.

Please re-open this issue if we can assist further.

from ts-protoc-gen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.