Update inputSourceMap according to loader transformations#78
Open
tsufiev wants to merge 2 commits intobem:masterfrom
Open
Update inputSourceMap according to loader transformations#78tsufiev wants to merge 2 commits intobem:masterfrom
tsufiev wants to merge 2 commits intobem:masterfrom
Conversation
Since bem-loader expands certain require()-s in the beginning of the module, all subsequent source maps need to be adjusted by the introduced line offset. Do a correct mapping as well for the transformed require()-s themselves. Source map adjustments take place when the 'devtool' option passed into webpack toplevel config is not `false`.
Author
|
This is a tentative fix for the source maps issues introduced by webpack-bem-loader when it is used in chain with babel-loader (babel-loader comes rightmost in the loaders array and is applied first, then comes the webpack-bem-loader). It might be that a case of empty inputSourceMap should be addressed as well, though I'm not sure if anybody uses webpack-bem-loader without babel-loader. |
Member
|
@tsufiev thank you so much for this PR! But can you provide some example or test to reproduce the bug and ensure that this PR fixes it? |
* creating sourcemap from scratch (no input sourcemap) * writing unit tests
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Since bem-loader expands certain require()-s in the beginning of the
module, all subsequent source maps need to be adjusted by the
introduced line offset. Do a correct mapping as well for the transformed
require()-s themselves.
Source map adjustments take place when the 'devtool' option passed into
webpack toplevel config is not
false.