Skip to content

Get rid of webpack's prefix on TypeError #2257

Closed
@RohovDmytro

Description

@RohovDmytro

Image

The source code is prettified by sourcemaps, but the error title does not fully correspond with it.

Activity

gaearon

gaearon commented on May 19, 2017

@gaearon
Contributor

Yea, it's not super nice. But it's important to have it match the compiled code because if the error is really weird, you'll want to switch to "view compiled" and see if it's Babel messing things up or not. In this case it's very valuable to have the error correspond exactly to the code that runs in the browser.

I think the right solution here is to lobby Webpack to change that prefix to something shorter 😄 .

RohovDmytro

RohovDmytro commented on May 19, 2017

@RohovDmytro
Author

@gaearon can we apply sourcemaps to make error more readable? We can show it's real content only if user is clicking on «View compiled»

It's not super important. It's just that this overlay is super nice feature 😈

gaearon

gaearon commented on May 19, 2017

@gaearon
Contributor

I'm not sure if there's a way to map variables back, but let me know if you find it :-)

Timer

Timer commented on May 19, 2017

@Timer
Contributor

I'm pretty sure the variable maps are explicitly excluded/stripped by webpack's cheap maps.
See webpack/source-list-map#2

gaearon

gaearon commented on May 19, 2017

@gaearon
Contributor

Ah. It's probably not intentional though? They're excluded because transform couldn't handle them, but not because they're necessarily expensive (I don't know, just a guess). If that's true maybe we can contribute to pass them through.

gaearon

gaearon commented on Jan 8, 2018

@gaearon
Contributor

I feel like we should preserve the original text for more complex scenarios. Obfuscating it could actually make debugging more confusing.

I suggest you to file this with webpack and ask them to use a shorter obscure sequence. For example __webpack_import_0__lodash_default.

gaearon

gaearon commented on Jan 8, 2018

@gaearon
Contributor
locked and limited conversation to collaborators on Jan 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Timer@gaearon@RohovDmytro

        Issue actions

          Get rid of webpack's prefix on TypeError · Issue #2257 · facebook/create-react-app