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

feat: add option to keep source maps #216

Merged
merged 6 commits into from
Nov 9, 2020
Merged

feat: add option to keep source maps #216

merged 6 commits into from
Nov 9, 2020

Conversation

sibiraj-s
Copy link
Contributor

This PR contains a:

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

Motivation / Use-Case

Fixes #215 . Added option to not delete sourcemap when deleting the originalAsset

Breaking Changes

none

Additional Info

none

README.md Outdated
@@ -289,7 +289,7 @@ module.exports = {

### `deleteOriginalAssets`

Type: `Boolean`
Type: `Boolean|keep-source-map`
Copy link
Member

Choose a reason for hiding this comment

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

Boolean | 'keep-source-map'

const updatedAssetInfo = {
...info,
related: { ...info.related, sourceMap: null },
};
Copy link
Member

@alexander-akait alexander-akait Nov 6, 2020

Choose a reason for hiding this comment

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

Let's do it better:

delete updatedAssetInfo.related.sourceMap;

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 tried this, this is not working. The sourceMap is getting added back if a value is not provided.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Webpack I think is doing a smart merge there. 🤔

393,
],
Array [
"async.async.1c2911c7c819fc826fb7.js",
Copy link
Member

Choose a reason for hiding this comment

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

hm, I think we should have source map here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Source map was not generated for that.

  [
      '09a1a1112c577c2794359715edfcb5ac.png',
      '23fc1d3ac606d117e05a140e0de79806.svg',
      'main.6a5afd3ff5b2f0fa8aaa.js',
      'async.async.1c2911c7c819fc826fb7.js',
      'main.6a5afd3ff5b2f0fa8aaa.js.map'
    ]

these are the total assets included for compression.

@codecov
Copy link

codecov bot commented Nov 6, 2020

Codecov Report

Merging #216 (c13d8f6) into master (37b53e7) will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #216      +/-   ##
==========================================
+ Coverage   98.18%   98.21%   +0.03%     
==========================================
  Files           4        4              
  Lines         165      168       +3     
  Branches       48       49       +1     
==========================================
+ Hits          162      165       +3     
  Misses          2        2              
  Partials        1        1              
Impacted Files Coverage Δ
src/index.js 97.74% <100.00%> (+0.05%) ⬆️

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 37b53e7...c13d8f6. Read the comment docs.

@sibiraj-s
Copy link
Contributor Author

I am not sure why tests are failing. I tested with both webpack 4 and 5 in local everything works fine 🤔

@sibiraj-s
Copy link
Contributor Author

sibiraj-s commented Nov 6, 2020

Ah, Found it. latest version webpack is v5.4 in CI, in local it is v5.3. I have updated the dep to 5.4. let me know. If I need to revert it or raise it in a separate PR.

@alexander-akait
Copy link
Member

All is fine

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.

Sourcemaps are not emitted when excluded with deleteOriginalAssets option
2 participants