Giter Club home page Giter Club logo

Comments (5)

omgoshjosh avatar omgoshjosh commented on May 23, 2024 2

so i actually just brought in all of react-dev-utils because its 2020 and the singularity is gonna happen soon anyway so why worry about performance or bundle size etc...

anyway, i have found what is working for me is based on a few things.

  1. facebook/create-react-app#2344 (comment)
    a. first i tried what dan abramov (gaeron) says in this issue, using react-error-overlay
  2. facebook/create-react-app#3097 (comment)
    a. then i got it up and running by installing the full react-dev-utils and using the suggestion of basically just replacing some strings instead of using the ones provided by abramov (gaeron) in the previous issue
    b. replace react-error-overlay with react-dev-utils/webpackHotDevClient
    c. replace react-error-overlay/middleware with react-dev-utils/errorOverlayMiddleware
  3. webpack config option: output.devtoolModuleFilenameTemplate
    a. here's where this open issue comes in, basically i was finding that the link i would click in the browser would not send me to the editor as i had wished and per my investigation, i found that the url given were paths/filenames to files that obviously didn't exist
    b. i found the link above which was admittedly not super clear to me, but looked familiar with a reference to this default value
    c. 'webpack://[namespace]/[resource-path]?[loaders]'
  4. https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/config/webpack.config.js#L231
    a. and here's what started opening the editor on click for me. basically i just copied the line for that webpack config key/value for dev mode and put it in my dev config and violá
'output': {
    // i added this one line to the rest of my output config in webpack.dev.config.js, which was otherwise left unchanged.
    'devtoolModuleFilenameTemplate': (info => path.resolve(info.absoluteResourcePath).replace(/\\/g, '/')),
}

so i guess what i'm trying to say is... that one config option is worth investigating as the potential solution somewhere for those who find this issue.

from error-overlay-webpack-plugin.

aditya2337 avatar aditya2337 commented on May 23, 2024

Did someone find a solution to this?

from error-overlay-webpack-plugin.

saneq1 avatar saneq1 commented on May 23, 2024

no

from error-overlay-webpack-plugin.

vjpr avatar vjpr commented on May 23, 2024

Can also do something like:

  app.use((req, res, next) => {
    // We get: 'webpack:///packages/app/src/pages/home/Home.tsx'
    if (!req.url.startsWith(launchEditorEndpoint)) return
    const fileName = req.query.fileName.replace('webpack:///', './')
    req.query.fileName = fileName
    console.log('Opening in editor:', fileName)
    errorOverlayMiddleware()(req, res, next)
  })

from error-overlay-webpack-plugin.

gregberge avatar gregberge commented on May 23, 2024

@vjpr maybe we could find a way to make it work by default?

from error-overlay-webpack-plugin.

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.