Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve documentation on devtool #1533

Merged
merged 4 commits into from
Aug 24, 2017
Merged

Improve documentation on devtool #1533

merged 4 commits into from
Aug 24, 2017

Conversation

sokra
Copy link
Member

@sokra sokra commented Aug 22, 2017

T> `+` means faster, `-` slower and `o` about the same time

Some of these values are suited for development and some for production. For development you typically want fast Source Maps at the cost of bundle size, but for production you want separate Source Maps that are accurate.
T> Instead of using the `devtool` option you can also use the `SourceMapDevToolPlugin`/`EvalSourceMapDevToolPlugin` directly. It has more options. You must never use both `devtool` option and plugin!
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

T> Instead of using the devtool option you can also use SourceMapDevToolPlugin/EvalSourceMapDevToolPlugin directly as it has more options. Never use both the devtool option and plugin together.

T> `+` means faster, `-` slower and `o` about the same time

Some of these values are suited for development and some for production. For development you typically want fast Source Maps at the cost of bundle size, but for production you want separate Source Maps that are accurate.
T> Instead of using the `devtool` option you can also use the `SourceMapDevToolPlugin`/`EvalSourceMapDevToolPlugin` directly. It has more options. You must never use both `devtool` option and plugin!
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sokra Can we say why someone shouldn't use them together?

hidden-source-map | -- | -- | yes | original source
nosources-source-map | -- | -- | yes | without source content

T> `+++` super fast, `++` pretty fast, `+` fast, `o` medium, `-` slow, `--` pretty slow
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sokra You had a previous commit that used very fast, I think that's actually better, as 'pretty' would typically be one before 'fast'.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CI didn't allowed me to use very.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, I guess it labels it as a 'weasel word', which is kind of true, but an indication there are times you might want it 😆 .

Thanks!


W> There are some issues with Source Maps in Chrome. [We need your help!](https://github.com/webpack/webpack/issues/3165).

T> See [`output.sourceMapFilename`](/configuration/output#output-sourcemapfilename) to customize the filenames of generated Source Maps.

### Qualities
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sokra Can we add a line break between the explanation and the examples?


`hidden-source-map` - Same as `source-map`, but doesn't add a reference comment to the bundle. Useful if you only want SourceMaps to map error stack traces from error reports, but don't want to expose your SourceMap for the browser development tools.
`source-map` - A full SourceMap is emitted as a separate file. It adds a reference comment to the bundle so development tools know where to find it. Warning: You should configure your server to disallow access to the Source Map file for normal users!
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sokra Could we add a line break between the explanation and the warning? Ideally this would be formatted differently, but we'll worry about that later.


`cheap-source-map` - A SourceMap without column-mappings ignoring loaded Source Maps.
`hidden-source-map` - Same as `source-map`, but doesn't add a reference comment to the bundle. Useful if you only want SourceMaps to map error stack traces from error reports, but don't want to expose your SourceMap for the browser development tools. Warning: You should not deploy the Source Map file to the webserver. Instead only use it for error report tooling.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sokra Could we add a line break between the explanation and the warning? Ideally this would be formatted differently, but we'll worry about that later.


`cheap-module-source-map` - A SourceMap without column-mappings that simplifies loaded Source Maps to a single mapping per line.
`nosources-source-map` - A SourceMap is created without the `sourcesContent` in it. It can be used to map stack traces on the client without exposing all of the source code. You can deploy the Source Map file to the webserver. Warning: It still exposes filenames and structure for decompiling, but it doesn't expose the original code.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sokra Could we add a line break between the explanation and the warning? Ideally this would be formatted differently, but we'll worry about that later.

Copy link
Collaborator

@ChrisChinchilla ChrisChinchilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @sokra I'm working with the Webpack docs to improve and polish language as much as possible, here are a few suggestions…

Thanks for the contribution.

@sokra
Copy link
Member Author

sokra commented Aug 23, 2017

@ChrisChinchilla Thanks for your feedback.

`source-map` - A full SourceMap is emitted as a separate file. It adds a reference comment to the bundle so development tools know where to find it.

W> You should configure your server to disallow access to the Source Map file for normal users!
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ChrisChinchilla we actually can format them differently (as @sokra did here). We have custom markdown syntax enabled so that you can use W> for a warning, T> for a tip, and ?> for a TODO. I think this is mentioned in the writer's guide but if it's not feel free to submit a PR.

Copy link
Collaborator

@skipjack skipjack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sokra awesome work and @ChrisChinchilla thanks for reviewing! I think this one also resolves #273.

@skipjack
Copy link
Collaborator

I'm going to work on resolving the conflicts here and in the other approved PRs as soon as I get some time so we can get these things merged. They're due to the major restructuring from #1490.

@skipjack skipjack merged commit 4d5eb08 into master Aug 24, 2017
@skipjack skipjack deleted the content/devtool branch August 24, 2017 06:13
@skipjack
Copy link
Collaborator

skipjack commented Aug 24, 2017

@sokra merged, you should be able to close those issues on the main repo now. (it doesn't seem like the "fixes" keyword works across repos unfortunately, although maybe there's good reason for that)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants