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: errors generated by source maps loader #428

Merged

Conversation

solababs
Copy link
Contributor

@solababs solababs commented Jul 25, 2023

Description

This PR fixes errors generated by source-maps-loader for some packages.
Careful consideration is taken to only ignore issues generated by node modules as some third party packages may ship miss-configured sourcemaps, that interrupts the build.
See: facebook/create-react-app#11278 (comment) and facebook/create-react-app#11752

Supporting information

This PR fixes openedx/paragon#1674

Testing instructions

On running npm run build on any of the MFE's you would have an error similar to the below
image
The error to look out for here is Failed to parse source map
After this fix the error should be gone and not show up on running npm run build.
Some MFE's have multiple of these errors and should be gone also.

Fixes: openedx/paragon#1674
Private-ref: https://tasks.opencraft.com/browse/BB-7705

@openedx-webhooks
Copy link

openedx-webhooks commented Jul 25, 2023

Thanks for the pull request, @solababs! Please note that it may take us up to several weeks or months to complete a review and merge your PR.

Feel free to add as much of the following information to the ticket as you can:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here.

Please let us know once your PR is ready for our review and all tests are green.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Jul 25, 2023
@solababs solababs changed the title fix: errors generated by source maps loader fix: errors generated by source maps loader Jul 25, 2023
@solababs solababs changed the title fix: errors generated by source maps loader fix: errors generated by source maps loader Jul 25, 2023
@solababs solababs marked this pull request as ready for review July 26, 2023 07:10
@itsjeyd
Copy link

itsjeyd commented Jul 26, 2023

Hey @solababs, thank you for this contribution!

We'll get tests enabled for you next.

@itsjeyd itsjeyd added the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Jul 26, 2023
Copy link

@xitij2000 xitij2000 left a comment

Choose a reason for hiding this comment

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

👍
The change looks good in general, but I think it's misplaced.
Additionally, what are the potential downsides of this? We are suppressing a warning, can we alternatively generate this sourcemap ourselves if the package doesn't provide it?

  • I tested this: tested againt building an MFE.
  • I read through the code
  • [na] I checked for accessibility issues
  • [na] Includes documentation

},
],
};
return merge(baseConfig, {...ignoreWarnings, ...configFragment});

Choose a reason for hiding this comment

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

I'm not sure, this is the right place for this. I think you should move it to config/webpack.common.config.js or config/webpack.prod.config.js.

Copy link
Contributor Author

@solababs solababs Jul 26, 2023

Choose a reason for hiding this comment

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

@xitij2000 thanks for the review

what are the potential downsides of this?

we would not be able to see source maps for vendor packages that have mis-configured source-maps that are in the node_modules

We are suppressing a warning, can we alternatively generate this sourcemap ourselves if the package doesn't provide it?

I tried generating the source-maps using rules but still got the same errors, best guess is some mis-configuration on some of the packages.

Of course we can move it to the webpack config files.
I'll update that

Choose a reason for hiding this comment

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

Instead of duplicating this, won't moving this to the common file fix the need for duplication.

@solababs solababs requested a review from xitij2000 July 27, 2023 05:24
@e0d e0d removed the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Jul 28, 2023
@e0d
Copy link

e0d commented Jul 28, 2023

Hi @solababs , looks like the same issue with the commit lint checker here too. Can you amend the messages to follow our standard?

@solababs solababs force-pushed the solababs/fix-source-maps-errors branch from 615b33d to 4d11120 Compare July 30, 2023 15:56
@solababs
Copy link
Contributor Author

Hi @solababs , looks like the same issue with the commit lint checker here too. Can you amend the messages to follow our standard?

@e0d Thanks, this is fixed

@itsjeyd
Copy link

itsjeyd commented Aug 1, 2023

@xitij2000 Just checking in to see if you're good with these changes now?

@abdullahwaheed An early heads-up that this PR should be ready for engineering review by fed-bom soon.

CC @solababs

Copy link

@xitij2000 xitij2000 left a comment

Choose a reason for hiding this comment

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

👍 Looks good!

I tested this patch against frontend-app-account and it reduced the warnings from 14 to 5, since 9 were related to source-map-loader.

  • I tested this: testing against frontend-app-account
  • I read through the code

@xitij2000
Copy link

@xitij2000 Just checking in to see if you're good with these changes now?
I've tested the PR again and approved it.

@abdullahwaheed abdullahwaheed merged commit ad42423 into openedx:master Aug 2, 2023
3 checks passed
@edx-semantic-release
Copy link

🎉 This PR is included in version 12.9.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open-source-contribution PR author is not from Axim or 2U released
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

react-responsive.js URL is not supported
7 participants