Best convention to transpile javascript+jsx source-code in browser?










1















I'm interested in knowing about what's the best convention, approach or best practice to transpile source code in the browser, as we have in projects like:



  • Code Sandbox
    https://codesandbox.io/s/vanilla


  • Style guidist
    https://react-styleguidist.js.org


The approach these projects take, is a sort of Hot-reload, which is common use in most modern UI projects; it's not novelty and that's not what I want to discuss about; But if you think about the "same" concept in a production server, you might question what'd be the best approach to apply this principle, right? Would you POST the code Server-side? We'd have to think about security! Maybe, workout which Browser supports JSX out of the box (there's none at a moment I can think of)? Request the user to write vanilla Javascript and add React and React-Dom through script tags?! Or use a Javascript transpiler like Babel and, use the Babel-Standalone to do it? Oh well, again, that's not advised, right?! So, I hope that at this point you understand that it's an interesting question, hopefully!



I mean, as you see there's plenty of options, some raise some questions and possibilities; This might be interesting for some and I guess irrelevant for other's, or maybe it's quite trivial, and I should have spent the time to review the Github repositories before being flammed here for asking this question.



Any hint or suggestion is highly appreciated!



Thank you!










share|improve this question


























    1















    I'm interested in knowing about what's the best convention, approach or best practice to transpile source code in the browser, as we have in projects like:



    • Code Sandbox
      https://codesandbox.io/s/vanilla


    • Style guidist
      https://react-styleguidist.js.org


    The approach these projects take, is a sort of Hot-reload, which is common use in most modern UI projects; it's not novelty and that's not what I want to discuss about; But if you think about the "same" concept in a production server, you might question what'd be the best approach to apply this principle, right? Would you POST the code Server-side? We'd have to think about security! Maybe, workout which Browser supports JSX out of the box (there's none at a moment I can think of)? Request the user to write vanilla Javascript and add React and React-Dom through script tags?! Or use a Javascript transpiler like Babel and, use the Babel-Standalone to do it? Oh well, again, that's not advised, right?! So, I hope that at this point you understand that it's an interesting question, hopefully!



    I mean, as you see there's plenty of options, some raise some questions and possibilities; This might be interesting for some and I guess irrelevant for other's, or maybe it's quite trivial, and I should have spent the time to review the Github repositories before being flammed here for asking this question.



    Any hint or suggestion is highly appreciated!



    Thank you!










    share|improve this question
























      1












      1








      1








      I'm interested in knowing about what's the best convention, approach or best practice to transpile source code in the browser, as we have in projects like:



      • Code Sandbox
        https://codesandbox.io/s/vanilla


      • Style guidist
        https://react-styleguidist.js.org


      The approach these projects take, is a sort of Hot-reload, which is common use in most modern UI projects; it's not novelty and that's not what I want to discuss about; But if you think about the "same" concept in a production server, you might question what'd be the best approach to apply this principle, right? Would you POST the code Server-side? We'd have to think about security! Maybe, workout which Browser supports JSX out of the box (there's none at a moment I can think of)? Request the user to write vanilla Javascript and add React and React-Dom through script tags?! Or use a Javascript transpiler like Babel and, use the Babel-Standalone to do it? Oh well, again, that's not advised, right?! So, I hope that at this point you understand that it's an interesting question, hopefully!



      I mean, as you see there's plenty of options, some raise some questions and possibilities; This might be interesting for some and I guess irrelevant for other's, or maybe it's quite trivial, and I should have spent the time to review the Github repositories before being flammed here for asking this question.



      Any hint or suggestion is highly appreciated!



      Thank you!










      share|improve this question














      I'm interested in knowing about what's the best convention, approach or best practice to transpile source code in the browser, as we have in projects like:



      • Code Sandbox
        https://codesandbox.io/s/vanilla


      • Style guidist
        https://react-styleguidist.js.org


      The approach these projects take, is a sort of Hot-reload, which is common use in most modern UI projects; it's not novelty and that's not what I want to discuss about; But if you think about the "same" concept in a production server, you might question what'd be the best approach to apply this principle, right? Would you POST the code Server-side? We'd have to think about security! Maybe, workout which Browser supports JSX out of the box (there's none at a moment I can think of)? Request the user to write vanilla Javascript and add React and React-Dom through script tags?! Or use a Javascript transpiler like Babel and, use the Babel-Standalone to do it? Oh well, again, that's not advised, right?! So, I hope that at this point you understand that it's an interesting question, hopefully!



      I mean, as you see there's plenty of options, some raise some questions and possibilities; This might be interesting for some and I guess irrelevant for other's, or maybe it's quite trivial, and I should have spent the time to review the Github repositories before being flammed here for asking this question.



      Any hint or suggestion is highly appreciated!



      Thank you!







      node.js reactjs jsx babel transpiler






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 14 '18 at 17:37









      punkbitpunkbit

      3,16163156




      3,16163156






















          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53305904%2fbest-convention-to-transpile-javascriptjsx-source-code-in-browser%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53305904%2fbest-convention-to-transpile-javascriptjsx-source-code-in-browser%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Use pre created SQLite database for Android project in kotlin

          Darth Vader #20

          Ondo