Skip to content

Commit beee50b

Browse files
SpaceK33zTheLarkInn
authored andcommitted
More devtool docs (#375)
1 parent e904b07 commit beee50b

File tree

1 file changed

+35
-19
lines changed

1 file changed

+35
-19
lines changed

content/configuration/devtool.md

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,16 @@ sort: 10
44
contributors:
55
- sokra
66
- skipjack
7+
- SpaceK33z
78
---
89

9-
?> Description...
10+
This option controls if and how Source Maps are generated.
1011

1112
## `devtool`
1213

13-
`string`
14+
`string` `false`
1415

15-
Choose a style of [source mapping](http://blog.teamtreehouse.com/introduction-source-maps) to enhance the debugging process. Be aware that the following options can affect build and rebuild speed dramatically...
16-
17-
`eval` - Each module is executed with `eval` and `//@ sourceURL`
18-
19-
`source-map` - A full SourceMap is emitted
20-
21-
`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.
22-
23-
`inline-source-map` - A SourceMap is added as DataUrl to the bundle
24-
25-
`eval-source-map` - Each module is executed with `eval` and a SourceMap is added as DataUrl to the `eval`
26-
27-
`cheap-source-map` - A SourceMap without column-mappings ignoring loaded source maps
28-
29-
`cheap-module-source-map` - A SourceMap without column-mappings that simplifies loaded source maps to a single mapping per line
16+
Choose a style of [source mapping](http://blog.teamtreehouse.com/introduction-source-maps) to enhance the debugging process. These values can affect build and rebuild speed dramatically.
3017

3118
devtool | build | rebuild | production | quality
3219
------------------------------|-------|---------|------------|--------------------------
@@ -38,7 +25,36 @@ Choose a style of [source mapping](http://blog.teamtreehouse.com/introduction-so
3825
eval-source-map | -- | + | no | original source
3926
source-map | -- | -- | yes | original source
4027

28+
Some of these values are suited for development and some for production. For development you typically want very fast Source Maps at the cost of bundle size, but for production you want separate Source Maps that are accurate.
29+
30+
W> There are some issues with Source Maps in Chrome. [We need your help!](https://github.com/webpack/webpack/issues/3165).
31+
32+
### For development
33+
34+
`eval` - Each module is executed with `eval()` and `//@ sourceURL`. This is very fast. The main disadvantage is that it doesn't display line numbers correctly since it gets mapped to transpiled code instead of the original code.
35+
36+
`inline-source-map` - A SourceMap is added as DataUrl to the bundle.
37+
38+
`eval-source-map` - Each module is executed with `eval()` and a SourceMap is added as DataUrl to the `eval()`. Initially it is slow, but it provides fast rebuild speed and yields real files. Line numbers are correctly mapped since it gets mapped to the original code.
39+
40+
`cheap-module-eval-source-map` - Like `eval-source-map`, each module is executed with `eval()` and a SourceMap is added as DataUrl to the `eval()`. It is "cheap" because it doesn't have column mappings, it only maps line numbers.
41+
42+
### For production
43+
44+
`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.
45+
46+
`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.
47+
48+
`cheap-source-map` - A SourceMap without column-mappings ignoring loaded Source Maps.
49+
50+
`cheap-module-source-map` - A SourceMap without column-mappings that simplifies loaded Source Maps to a single mapping per line.
51+
52+
T> See [`output.sourceMapFilename`](/configuration/output#output-sourcemapfilename) to customize the filenames of generated Source Maps.
53+
54+
?> This page needs more information to make it easier for users to choose a good option.
4155

42-
T> See [`output.sourceMapFilename`](/configuration/output#output-sourcemapfilename) to customize the filenames of generated source maps.
56+
# References
4357

44-
?> This section is pretty much just copied over from existing docs... imo more background is needed on the different types of source mapping, maybe via links to external sites that discuss the different types of source maps in more detail.
58+
- [Enabling Sourcemaps](http://survivejs.com/webpack/developing-with-webpack/enabling-sourcemaps/)
59+
- [webpack devtool source map](http://cheng.logdown.com/posts/2016/03/25/679045
60+
)

0 commit comments

Comments
 (0)