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

Update inputSourceMap according to loader transformations #78

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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.

None yet

3 participants