Skip to content

Allow to skip sourcemaps from the package #470

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
jaydp17 opened this issue Jan 5, 2019 · 4 comments
Closed

Allow to skip sourcemaps from the package #470

jaydp17 opened this issue Jan 5, 2019 · 4 comments
Labels
Milestone

Comments

@jaydp17
Copy link
Contributor

jaydp17 commented Jan 5, 2019

This is a Feature Proposal

Description

Allow filtering files after webpack runs but before packaging.

When you have source maps enabled, source-maps get bundled in the deployment package (zip file) along with the compiled js bundle.

If you're using a separate Error Reporting system like Sentry you don't need to upload the source maps in the package zip file. This reduces the final package zip size by ~ 50%.

Why not disable source-maps in webpack?

If we do that, then we'll have to build once again after packaging/deploy to get the source-maps to upload to Sentry.

P.S. I don't mind sending a PR for this, I just want to use this issue to discuss the feature

Additional Data

  • Serverless-Webpack Version you're using: 5.2.0
  • Webpack version you're using: 4.28.2
  • Serverless Framework Version you're using: 1.35.0
  • Operating System: macOS
  • Stack Trace (if available):
@jaydp17 jaydp17 changed the title Allow to skip sourcemaps from the the package Allow to skip sourcemaps from the package Jan 5, 2019
@ouamer-dahmani
Copy link

ouamer-dahmani commented Sep 16, 2020

Hello guys!
Any progress on this issue?

My webpack config generates map files as well as report.html files from the bundle analyzer plugin. These get bundled thus more than doubling the size of my lambda packages.

One workaround I tried was to force the path of source map to a different folder. However this does not work for the bundle size report with multiple entry points as it is not compatible with qualifiers such as [file].

I also tried adding entries in a .gitignore file so that npm does not package them but that does not work either.

It would be great if I could just tell serverless webpack to ignore those files.

Thanks!

@MikeRippon
Copy link

Hello guys!
Any progress on this issue?

My webpack config generates map files as well as report.html files from the bundle analyzer plugin. These get bundled thus more than doubling the size of my lambda packages.

One workaround I tried was to force the path of source map to a different folder. However this does not work for the bundle size report with multiple entry points as it is not compatible with qualifiers such as [file].

I also tried adding entries in a .gitignore file so that npm does not package them but that does not work either.

It would be great if I could just tell serverless webpack to ignore those files.

Thanks!

I have this same problem. It's wonderfully ironic that I wanted to analyze the bundle size to make it smaller, but the report.html doubled it's size!

@j0k3r
Copy link
Member

j0k3r commented May 10, 2021

We do have an option excludeRegex which remove some fiels from the zip.
https://github.com/serverless-heaven/serverless-webpack#exclude-files-with-regular-expression

Can this solve your problem?

@MikeRippon
Copy link

That seems to fix it for me on v5.5.0 thanks!

custom:
  webpack:
    excludeRegex: report\.html

@j0k3r j0k3r added this to the 5.5.0 milestone Jun 4, 2021
@j0k3r j0k3r closed this as completed Jun 4, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants