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

fix: fix #111 by generating sourcemaps even when a previous loader didn't pass them #113

Merged
merged 2 commits into from
Nov 1, 2021
Merged

Conversation

benjamin-hodgson
Copy link
Contributor

@benjamin-hodgson benjamin-hodgson commented Oct 31, 2021

This PR contains a:

  • bugfix
  • new feature
  • code refactor
  • test update
  • typo fix
  • metadata update

Motivation / Use-Case

See isse #111. imports-loader was only generating sourcemaps when a previous loader in the chain had already provided one. Webpack itself still generates a sourcemap in these conditions, but it was incorrect due to the missing mappings for the code injected by imports-loader.

There is probably some room for improvement here, would be good to map an artificial source file for the code which was injected by imports-loader.

The existing tests were not very good - they checked that the compilation had run and produced an output JS file, but didn't even check that sourcemaps had been generated, let alone that the sourcemap was correct.

};"
`;

exports[`loader should work with source maps when the "devtool" option is enabled: warnings 1`] = `Array []`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not remove tests

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't remove the test, I rewrote it.

@codecov
Copy link

codecov bot commented Nov 1, 2021

Codecov Report

Merging #113 (b6c480a) into master (4cbba7a) will increase coverage by 0.21%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #113      +/-   ##
==========================================
+ Coverage   91.81%   92.03%   +0.21%     
==========================================
  Files           3        3              
  Lines         220      226       +6     
  Branches       85       86       +1     
==========================================
+ Hits          202      208       +6     
  Misses         12       12              
  Partials        6        6              
Impacted Files Coverage Δ
src/index.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4cbba7a...b6c480a. Read the comment docs.

@alexander-akait alexander-akait merged commit 6f948c2 into webpack-contrib:master Nov 1, 2021
@benjamin-hodgson
Copy link
Contributor Author

Thank you!

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.

2 participants