sourceMappingURL directive can fail if a bundled module specifies the directive
See original GitHub issueIf a bundled module has a sourceMappingURL
directive, browserify will leave it intact, which appears to be worthless or harmful towards getting source maps to work properly in browsers.
Ideally, when browserify is generating source maps it would detect sourceMappingURL
directives in bundled modules and include the contents of the targeted source maps in the bundle’s source map. At very least, the directives should be removed during bundling to prevent possible conflicts.
The same issue is present in webpack, so I will refer to the bug report there rather than duplicate it: https://github.com/webpack/webpack/issues/273
The only difference between browserify and webpack with this issue is that browserify does not use the deprecated //@
form of the directive, so it will only see the issue of duplicate sourceMappingURL
directives when the bundled module has a directive in the form //# sourceMappingURL=...
.
Issue Analytics
- State:
- Created 9 years ago
- Reactions:2
- Comments:23 (2 by maintainers)
Top GitHub Comments
I just added a sample repo here: https://github.com/jeremija/lerna-ts-example. Instructions provided in
README.md
.EDIT I just realized that there is an easier way to do this in TypeScript, without the need for
sourceify
. ThesourceMap
property needs to be removed fromtsconfig.json
, and bothinlineSourceMap
andinlineSources
need to be set totrue
.Still,
sourceify
is useful in cases of 3rd-party libraries which might have source map file references instead of inlined sources.browser-pack should merge source maps correctly afaik. transforms are individually responsible for reading input source maps and outputting merged ones. i’m not sure what specifically is going wrong for people in this issue, but with a repro i could take a look at it