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 webpack imports in npm package #905

Merged
merged 1 commit into from
Feb 29, 2024
Merged

Conversation

patrickhousley
Copy link
Contributor

Fixing some import overrides in our NPM package build to prevent imports existing that include code reliant on webpack globals. This will resolve the error Uncaught ReferenceError: __webpack_require__ is not defined when using the NPM package in a project that does not use webpack.

Overview

Our import overrides for the couple of files that access webpack globals was not being applied correctly. This resulted in imports for code that relied on webpack globals in the NPM package. If the customer is not using webpack, this will result in a runtime error.

Related Issue(s)

https://new-relic.atlassian.net/browse/NR-233660

Testing

I could not find a good way to test this issue in an automated way. To verify manually, search the dist directory for imports of nonce and public-path

Copy link

Asset Size Report

Merging this pull request will result in the following asset size changes:

Agent Asset Previous Size New Size Diff
lite loader 30.61 kB / 10.69 kB (gzip) 30.61 kB / 10.69 kB (gzip) 0% / 0% (gzip)
lite async-chunk 45.89 kB / 15.11 kB (gzip) 45.89 kB / 15.11 kB (gzip) 0% / 0% (gzip)
pro loader 49.51 kB / 16.88 kB (gzip) 49.51 kB / 16.88 kB (gzip) 0% / 0% (gzip)
pro async-chunk 75.55 kB / 23.79 kB (gzip) 75.55 kB / 23.79 kB (gzip) 0% / 0% (gzip)
spa loader 55.99 kB / 18.86 kB (gzip) 55.99 kB / 18.86 kB (gzip) 0% / 0% (gzip)
spa async-chunk 90.32 kB / 28.19 kB (gzip) 90.32 kB / 28.19 kB (gzip) 0% / 0% (gzip)
lite-polyfills loader 125.22 kB / 39.94 kB (gzip) 125.22 kB / 39.94 kB (gzip) 0% / 0% (gzip)
lite-polyfills async-chunk 58.26 kB / 17.21 kB (gzip) 58.26 kB / 17.21 kB (gzip) 0% / 0% (gzip)
pro-polyfills loader 145.04 kB / 45.8 kB (gzip) 145.04 kB / 45.8 kB (gzip) 0% / 0% (gzip)
pro-polyfills async-chunk 101.84 kB / 27.59 kB (gzip) 101.84 kB / 27.59 kB (gzip) 0% / 0% (gzip)
spa-polyfills loader 153.07 kB / 47.95 kB (gzip) 153.07 kB / 47.95 kB (gzip) 0% / 0% (gzip)
spa-polyfills async-chunk 117.39 kB / 32.57 kB (gzip) 117.39 kB / 32.57 kB (gzip) 0% / 0% (gzip)

Copy link

codecov bot commented Feb 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.11%. Comparing base (0f40534) to head (fa0d538).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #905   +/-   ##
=======================================
  Coverage   79.11%   79.11%           
=======================================
  Files         146      146           
  Lines        6556     6556           
  Branches     1277     1277           
=======================================
  Hits         5187     5187           
  Misses       1157     1157           
  Partials      212      212           
Flag Coverage Δ
unit-tests 55.45% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@patrickhousley patrickhousley merged commit 35810a8 into main Feb 29, 2024
17 checks passed
@patrickhousley patrickhousley deleted the fix-imports-npm branch February 29, 2024 17:41
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