Search code examples
reactjsjsxuglifier

How to recover original code file parsed by React build?


I'm working on React old projects and several of them have the native structure, like:

...{
    key: "render",
    value: function () {
      return React.createElement(
        "div",
        {
          className: "WrapperExamQuery",
          id: "IndexComponent",
        },
        React.createElement(
          "div",
          {
            className: "loadingWraper",
          },
          React.createElement(
            "div",
            {
              className: "teamLoading",
            },
            React.createElement("span", null, "loading... ")...

In my actual working team, nobody knows why is this, and don't find the orignal code (if exist). Is there a tool to parse o unparse these files to work with React jsx normally? any advise will be welcome. Thanks!


Solution

  • We ran into the same issue a long time ago. And then we tried this library. It's not maintained anymore but you can try

    https://github.com/JoeStanton/babel-transform-js-to-jsx

    I hope it help :)