Open tsufiev opened 6 years ago
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.
@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?
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
.