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 tree-shaking E2E page in production #1825

Merged
merged 1 commit into from
Jan 11, 2024
Merged

Fix tree-shaking E2E page in production #1825

merged 1 commit into from
Jan 11, 2024

Conversation

lukaw3d
Copy link
Member

@lukaw3d lukaw3d commented Jan 11, 2024

TypeScript's import elision doesn't work with Parcel's dead branch removal.

@lukaw3d lukaw3d requested review from buberdds and csillag January 11, 2024 01:21
Copy link

github-actions bot commented Jan 11, 2024

Deployed to Cloudflare Pages

Latest commit: e9b0ec910f350debe88fbf127d6488f061487502
Status:✅ Deploy successful!
Preview URL: https://b331c2da.oasis-wallet.pages.dev

@lukaw3d
Copy link
Member Author

lukaw3d commented Jan 11, 2024

Hm. CI does not agree that anything more was tree-shaked:

Master After

https://github.com/oasisprotocol/oasis-wallet-web/actions/runs/7461968258/job/20303214966

build/index.html                                          1.46 KB    880ms
build/favicon.1644430d.ico                                4.19 KB    743ms
build/logo192.3188d2e4.png                                 1.8 KB    749ms
build/app.webmanifest                                       546 B    740ms
build/logo512.27ec9b68.png                                5.35 KB    749ms
build/oasis-og-image.jpg                                 25.51 KB    749ms
build/index.e8cb8fd8.js                               ⚠️  3.33 MB    4.83s
build/dump_validators.acf45ce6.js                       169.55 KB    870ms
build/web.d44f1718.js                                    15.82 KB    870ms
build/browser-polyfill.a1c17023.js                       12.64 KB    870ms
build/index.aa1151d7.css                                  4.69 KB    783ms
build/rubik-v20-latin-ext_latin-300.c36c8cce.woff2       20.12 KB    743ms
build/rubik-v20-latin-ext_latin-300.fa35505d.woff        26.21 KB    744ms
build/roboto-mono-v13-latin-300.7a9692de.woff2            12.4 KB    744ms
build/roboto-mono-v13-latin-300.592ef339.woff             15.2 KB    744ms
build/index.runtime.dfff4db2.js                            2.8 KB    870ms

https://github.com/oasisprotocol/oasis-wallet-web/actions/runs/7482952798/job/20367423291?pr=1825

build/index.html                                          1.46 KB    880ms
build/favicon.1644430d.ico                                4.19 KB    726ms
build/logo192.3188d2e4.png                                 1.8 KB    734ms
build/app.webmanifest                                       546 B    724ms
build/logo512.27ec9b68.png                                5.35 KB    734ms
build/oasis-og-image.jpg                                 25.51 KB    734ms
build/index.a94bec90.js                               ⚠️  3.33 MB    4.69s
build/dump_validators.acf45ce6.js                       169.55 KB    866ms
build/web.d44f1718.js                                    15.82 KB    866ms
build/browser-polyfill.a1c17023.js                       12.64 KB    866ms
build/index.aa1151d7.css                                  4.69 KB    735ms
build/rubik-v20-latin-ext_latin-300.c36c8cce.woff2       20.12 KB    727ms
build/rubik-v20-latin-ext_latin-300.fa35505d.woff        26.21 KB    727ms
build/roboto-mono-v13-latin-300.7a9692de.woff2            12.4 KB    727ms
build/roboto-mono-v13-latin-300.592ef339.woff             15.2 KB    728ms
build/index.runtime.bd6027fc.js                            2.8 KB    866ms
``` ```

Copy link

codecov bot commented Jan 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (c933e1d) 81.34% compared to head (e9b0ec9) 81.37%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1825      +/-   ##
==========================================
+ Coverage   81.34%   81.37%   +0.03%     
==========================================
  Files         192      192              
  Lines        5039     5042       +3     
  Branches      923      923              
==========================================
+ Hits         4099     4103       +4     
+ Misses        940      939       -1     
Flag Coverage Δ
cypress 46.05% <100.00%> (+0.06%) ⬆️
jest 77.16% <0.00%> (-0.05%) ⬇️

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

Files Coverage Δ
src/commonRoutes.tsx 34.78% <100.00%> (+14.78%) ⬆️

@lukaw3d
Copy link
Member Author

lukaw3d commented Jan 11, 2024

Update: bundle no longer contains the string "Show unsafe inputs for Chrome". I guess the diff is <0.005 MB (inside 3.33 MB)

Copy link
Contributor

@buberdds buberdds left a comment

Choose a reason for hiding this comment

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

if we don't want to include e2e path with void lazy on prod we could do sth like (maybe)

const e2eRoutes = process.env.REACT_APP_E2E_TEST
  ? [
      {
        path: 'e2e',
        lazy: async () => {
          const { E2EPage } = await import('app/pages/E2EPage')
          return { element: <E2EPage /> }
        },
      },
    ]
  : []

  ...
  
  ...e2eRoutes,

@lukaw3d
Copy link
Member Author

lukaw3d commented Jan 11, 2024

+1; but this syntax seems cleaner:

if (process.env.REACT_APP_E2E_TEST) {
  commonRoutes.push({
    path: 'e2e',
    lazy: async () => {
      const { E2EPage } = await import('app/pages/E2EPage')
      return { element: <E2EPage /> }
    },
  })
}

TypeScript's import elision doesn't work with Parcel's dead branch removal.
@lukaw3d lukaw3d merged commit a6cb4f8 into master Jan 11, 2024
12 checks passed
@lukaw3d lukaw3d deleted the lw/treeshake-e2e branch January 11, 2024 13:45
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