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 packageSourceMaps option to WebpackPluginConfig #2581

Merged
merged 3 commits into from
Apr 29, 2022

Conversation

zac-jacobson
Copy link
Contributor

@zac-jacobson zac-jacobson commented Oct 15, 2021

Stop including source maps in a packages application by default.

Add packageSourceMaps to WebpackPluginConfig allow source maps to be included in the packaged application.

โœ… Closes: #2573

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project follows, as appropriate.
  • The changes are appropriately documented (if applicable).
  • The changes have sufficient test coverage (if applicable).
  • The testsuite passes successfully on my local machine (if applicable).

Summarize your changes:

Add a configuration option to WebpackPluginConfig:

packageSourceMaps?: boolean;

Update the forgeConfig.packagerConfig.ignore function in WebpackPlugin.resolveForgeConfig to return true if the filename ends in .js.map unless the above configuration option is set to true.

Add ignoreSourcemap to WebpackPluginConfig and use this to restrict
generated source-map files from being included in the packaged
application.

โœ… Closes: #2573
@phuctm97
Copy link

Can someone review and merge this. This looks really good.

@erickzhao erickzhao self-requested a review April 21, 2022 07:52
packages/plugin/webpack/src/WebpackPlugin.ts Outdated Show resolved Hide resolved
packages/plugin/webpack/src/Config.ts Outdated Show resolved Hide resolved
@zac-jacobson
Copy link
Contributor Author

Thanks for the review @erickzhao, I have made a change to address your comments.

@zac-jacobson zac-jacobson changed the title feat: ๐ŸŽธ Add ignoreSourcemap to WebpackPluginConfig feat: ๐ŸŽธ Add includeSourceMap to WebpackPluginConfig Apr 22, 2022
@codecov
Copy link

codecov bot commented Apr 22, 2022

Codecov Report

Merging #2581 (8fa6320) into master (cdbf7a6) will increase coverage by 9.37%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2581      +/-   ##
==========================================
+ Coverage   66.27%   75.64%   +9.37%     
==========================================
  Files          91       77      -14     
  Lines        2775     2361     -414     
  Branches      679      439     -240     
==========================================
- Hits         1839     1786      -53     
+ Misses        808      423     -385     
- Partials      128      152      +24     
Impacted Files Coverage ฮ”
packages/plugin/webpack/src/WebpackPlugin.ts 38.57% <100.00%> (+1.27%) โฌ†๏ธ
packages/plugin/base/src/Plugin.ts 57.14% <0.00%> (-30.36%) โฌ‡๏ธ
packages/installer/dmg/src/util/hdiutil.ts 25.00% <0.00%> (-26.86%) โฌ‡๏ธ
packages/installer/exe/src/InstallerExe.ts 60.00% <0.00%> (-15.00%) โฌ‡๏ธ
packages/installer/linux/src/InstallerLinux.ts 41.66% <0.00%> (-8.34%) โฌ‡๏ธ
packages/api/core/src/util/rebuild.ts 94.73% <0.00%> (-5.27%) โฌ‡๏ธ
packages/api/core/src/api/init.ts 91.66% <0.00%> (-3.08%) โฌ‡๏ธ
packages/api/cli/src/util/terminate.ts 18.75% <0.00%> (-1.25%) โฌ‡๏ธ
packages/api/core/src/util/yarn-or-npm.ts 93.33% <0.00%> (-1.12%) โฌ‡๏ธ
packages/maker/flatpak/src/MakerFlatpak.ts 80.95% <0.00%> (-0.87%) โฌ‡๏ธ
... and 65 more

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 cdbf7a6...8fa6320. Read the comment docs.

Copy link
Member

@erickzhao erickzhao left a comment

Choose a reason for hiding this comment

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

Sorry for a bit of nitpicking, but after giving this a bit more thought, I feel like making the flag more descriptive towards packaging might be useful, since there's no indication that this is for the package build only.

i.e.

- includeSourceMap
+ packageSourceMaps

@phuctm97
Copy link

Sorry for a bit of nitpicking, but after giving this a bit more thought, I feel like making the flag more descriptive towards packaging might be useful, since there's no indication that this is for the package build only.

i.e.

- includeSourceMap
+ packageSourceMaps

Eagerly waiting for this to be merged ๐Ÿ˜

@zac-jacobson zac-jacobson changed the title feat: ๐ŸŽธ Add includeSourceMap to WebpackPluginConfig feat: ๐ŸŽธ Add packageSourceMaps option to WebpackPluginConfig Apr 28, 2022
@zac-jacobson
Copy link
Contributor Author

i.e.

- includeSourceMap
+ packageSourceMaps

Makes sense @erickzhao , updated.

@erickzhao erickzhao merged commit 2bb5e0d into electron:master Apr 29, 2022
@zac-jacobson zac-jacobson deleted the ignore_sourcemap branch April 29, 2022 18:07
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.

Don't include webpack sourcemap files in packaged app
3 participants