Skip to content

Update inputSourceMap according to loader transformations#78

Open
tsufiev wants to merge 2 commits intobem:masterfrom
tsufiev:transform-with-source-maps
Open

Update inputSourceMap according to loader transformations#78
tsufiev wants to merge 2 commits intobem:masterfrom
tsufiev:transform-with-source-maps

Conversation

@tsufiev
Copy link

@tsufiev tsufiev commented Apr 5, 2018

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.

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`.
@coveralls
Copy link

coveralls commented Apr 5, 2018

Coverage Status

Coverage decreased (-0.3%) to 92.593% when pulling 9a9978b on tsufiev:transform-with-source-maps into d509488 on bem:master.

@tsufiev
Copy link
Author

tsufiev commented Apr 5, 2018

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.

@awinogradov
Copy link
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants