Code Monkey home page Code Monkey logo

Comments (2)

alexya avatar alexya commented on August 12, 2024

updated:
I tried to add babel.config.js in my project root folder

module.exports = function(api) {
  const isDevelopment = api.env('development');

  return {
    "presets": [
      [
        "@babel/preset-react",
        {
          "runtime": "automatic",
          "development": isDevelopment
        }
      ]
    ]
  };
};

or using the .babelrc as

{
  "presets": [
    ["@babel/preset-react", {
      "runtime": "automatic",
      "development": true
    }]
  ]
}

and modified my webpack.config.js as

{
        // Ignore test and story files
        test: /^((?!([-.]test|\.story)\.).)*\.ts(x?)$/,
        // Ignore unnecessary folders
        exclude: [/node_modules/, /node-sample/, /__mocks__/],
        include: [packagesDir],
        use: [
          { loader: 'babel-loader' },
          {
            loader: "esbuild-loader",
            options: {
              tsconfig: `${packageDir}/tsconfig.webpack.json`
            }
          }
        ]
      }

still failed to generate the debugSource & data-inspector in the div.

from react-dev-inspector.

zthxxx avatar zthxxx commented on August 12, 2024

@alexya Thanks for the detailed issue report! Here are some key points for troubleshooting:

  • The gotoVSCode() function directly calls the URL Scheme for the VSCode app from the browser. This means you don't need the server-side middleware launchEditorMiddleware.

    gotoVSCode
  • Webpack's loaders in module.rule run in reverse order. From what you’ve shown, babel-loader processes the output from esbuild-loader, this is the same as babel(esbuild(code)), so it misses the JSX syntax to transform in babel-loader.

  • esbuild can indeed generate the debugSource info when transforming JSX under jsx-dev option:

    So you don't need the babel-loader, maybe make sure have use esbuild>=0.14.54 to use the jsxDev option, and add that options to your config:

    {
      test: /\.tsx?$/,
      loader: 'esbuild-loader',
      options: {
        loader: 'tsx',
        // https://github.com/evanw/esbuild/blob/v0.20.0/lib/shared/types.ts#L58-L67
        jsx: 'automatic',
        jsxDev: process.env.NODE_ENV === 'development',
      },
    },

Hope this helps!

from react-dev-inspector.

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.