thomasbruggink commented on code in PR #3083:
URL: https://github.com/apache/thrift/pull/3083#discussion_r1922292098


##########
compiler/cpp/src/thrift/generate/t_js_generator.cc:
##########
@@ -556,7 +581,11 @@ string t_js_generator::render_includes() {
   if (gen_node_) {
     const vector<t_program*>& includes = program_->get_includes();
     for (auto include : includes) {
-      result += js_const_type_ + 
make_valid_nodeJs_identifier(include->get_name()) + "_ttypes = require('" + 
get_import_path(include) + "');\n";
+      if (gen_esm_) {
+        result += "import * as " + 
make_valid_nodeJs_identifier(include->get_name()) + "_ttypes from '" + 
get_import_path(include) + "';\n";

Review Comment:
   should this contain the `.mjs` extension?
   ```suggestion
           result += "import * as " + 
make_valid_nodeJs_identifier(include->get_name()) + "_ttypes from '" + 
get_import_path(include) + ".mjs';\n";
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@thrift.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to