This repository has been archived by the owner on Jul 27, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 77
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hi @rogeliog ! Is it ready to merge ? |
@geowarin Not yet, I first wanted to validate the main idea with you. It still needs some clean up and tests. Also, I want to make sure that we have the correct abstractions with the transformers and formatters, before moving forward with them :) |
@geowarin I added some tests and fixed some styling stuff. It should be in a better spot now :) |
rogeliog
changed the title
[WIP][Proposal] Initial approach
[Proposal] Initial approach
Aug 16, 2016
I just came back from holidays and stumbled upon your awesome PR, @rogeliog. Thank you so much!
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
More context here: facebook/create-react-app#401
Given that you created this repo I decided that it would make more sense to make a PR here rather than in the create-react-app repo.
This is a really early implementation of my proposal, please feel more than free to tell me if this is totally wrong :) There is still a lot of clean up that I need to do and add tests to all of it.
It would be great if we could make the core of this plugin agnostic of what the which types of errors it knows how to parse. In my proposal the plugin only knows that it has a set of transformers and a set of formatters. We could modify it so that the user could inject extra transformers and formatters in their Webpack config
new FriendlyErrorsWebpackPlugin({ extraTransformers: [...], extraFormatters: [...])
.There are two concepts that I've added. I'm still not super happy the names or the exact responsibilities of each of them, but I think that something like it could be interesting.
moduleNotFound
transformer will add the appropriate type and specific module name to the error.moduleNotFound
formatter will gather and group all the missing modules.Again, this is still an early implementation and I'm not super happy with parts of it, but this will also allow us easily unit test each of the transformers and formatter
Imagine if we could make it really easy to add any set of error formatters. That will mean that the community can build formatters for any specific use case, if someone already knows JavaScript but it is their first time exposed to ES6 they could add a something like a
es6HelpFormatter
that whenever errors like thisTypeError: Assignment to constant variable.
show up, it will also give them a detail explanation of whatconst
is, along with a link to a blog post or to MDN.