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: Remove webpack imports in npm package #925

Merged
merged 2 commits into from
Mar 25, 2024
Merged

Conversation

patrickhousley
Copy link
Contributor

@patrickhousley patrickhousley commented Mar 22, 2024

Transitioning certain module imports so that the default import is for the npm version of the module instead of the cdn or webpack version. This should completely eliminate all references to webpack globals when using the npm package.

Overview

Transitioned the import overrides from babel to webpack. The default imports for env, nonce, and public-path will not be the npm "version" of the module. Only during the webpack build will the imports for these modules be changed to import the cdn "version".

Related Issue(s)

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

Closes #902

Testing

  • All the existing tests should still pass.
  • The dist directory should have no files containing __webpack.
  • When loading up the cdn agent locally, you should still see the <blah>.cdn files in the chrome dev tools.

Copy link

github-actions bot commented Mar 22, 2024

Asset Size Report

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

Agent Asset Previous Size New Size Diff
lite loader 32.28 kB / 11.27 kB (gzip) 32.28 kB / 11.27 kB (gzip) 0% / -0.01% (gzip)
lite async-chunk 46.67 kB / 15.34 kB (gzip) 46.67 kB / 15.33 kB (gzip) 0% / -0.01% (gzip)
pro loader 51.45 kB / 17.49 kB (gzip) 51.45 kB / 17.49 kB (gzip) 0% / 0.02% (gzip)
pro async-chunk 88.05 kB / 27.04 kB (gzip) 88.05 kB / 27.04 kB (gzip) 0% / 0% (gzip)
spa loader 60.01 kB / 20.11 kB (gzip) 60.01 kB / 20.11 kB (gzip) 0% / 0.01% (gzip)
spa async-chunk 102.26 kB / 31.2 kB (gzip) 102.26 kB / 31.2 kB (gzip) 0% / 0% (gzip)
lite-polyfills loader 127.5 kB / 40.98 kB (gzip) 127.5 kB / 40.98 kB (gzip) 0% / -0.01% (gzip)
lite-polyfills async-chunk 60.19 kB / 17.58 kB (gzip) 60.19 kB / 17.58 kB (gzip) 0% / 0% (gzip)
pro-polyfills loader 147.53 kB / 46.91 kB (gzip) 147.53 kB / 46.91 kB (gzip) 0% / 0% (gzip)
pro-polyfills async-chunk 122.51 kB / 31.96 kB (gzip) 122.51 kB / 31.95 kB (gzip) 0% / 0% (gzip)
spa-polyfills loader 155.55 kB / 49.03 kB (gzip) 155.55 kB / 49.03 kB (gzip) 0% / 0% (gzip)
spa-polyfills async-chunk 139.01 kB / 36.43 kB (gzip) 139.01 kB / 36.43 kB (gzip) 0% / 0% (gzip)

Copy link

codecov bot commented Mar 22, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 80.56%. Comparing base (8ac37ba) to head (0e1a128).
Report is 1 commits behind head on main.

Files Patch % Lines
src/loaders/configure/nonce.cdn.js 60.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #925      +/-   ##
==========================================
+ Coverage   80.51%   80.56%   +0.04%     
==========================================
  Files         154      154              
  Lines        7057     7058       +1     
  Branches     1397     1400       +3     
==========================================
+ Hits         5682     5686       +4     
+ Misses       1171     1168       -3     
  Partials      204      204              
Flag Coverage Δ
integration-tests 89.91% <87.50%> (+<0.01%) ⬆️
unit-tests 58.41% <11.11%> (-0.06%) ⬇️

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.

Copy link

github-actions bot commented Mar 22, 2024

Static Badge

Last ran on March 25, 2024 10:52:30 CDT
Checking merge of (0e1a128) into main (fb4e36b)

@patrickhousley patrickhousley merged commit 7b35238 into main Mar 25, 2024
50 of 51 checks passed
@patrickhousley patrickhousley deleted the npm-centric branch March 25, 2024 16: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.

Error: Uncaught ReferenceError: __webpack_require__ is not defined at
2 participants