serlo / frontend

Next.js app that serves serlo.org
https://serlo.org
Apache License 2.0
36 stars 9 forks source link

Refactor(editor) replace NEXT env variables with custom rollup plugin #3879

Closed CodingDive closed 1 month ago

CodingDive commented 1 month ago

Consumers of the React package (@serlo/editor) had to define the process.env.NEXT_PUBLIC_ENV. Now we already remove it in the built of the editor, instead of the built of the editor-web-component which makes the life of consumers of the package slightly easier.

Works great for me. @LarsTheGlidingSquirrel I did check edusharing with yalc, but better double check that we are not breaking anything there as it uses Next.js under the hood. To be clear, this strips away the NEXT env variables at build time, so doesn't influence or overwrite the ones we are defining as part of edusharing.

vercel[bot] commented 1 month ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
frontend ✅ Ready (Inspect) Visit Preview Jun 11, 2024 5:21pm
github-actions[bot] commented 1 month ago

📦 Next.js Bundle Analysis for @serlo/frontend

This analysis was generated by the Next.js Bundle Analysis action. 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 103.86 KB (🟡 +1 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Twenty-one Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/[...slug] 82.24 KB (🟡 +1 B) 186.1 KB
/___bot_or_not 96.03 KB (🟡 +1 B) 199.89 KB
/___editor_preview 485.18 KB (-1 B) 589.04 KB
/biologie 157.7 KB (🟡 +1 B) 261.55 KB
/chemie 157.7 KB (🟡 +1 B) 261.55 KB
/content-only/[...slug] 74.67 KB (🟡 +1 B) 178.53 KB
/editor 105.94 KB (🟡 +1 B) 209.8 KB
/entity/create/[type]/[taxonomyId] 486.56 KB (-2 B) 590.42 KB
/entity/repository/add-revision/[...id] 485.86 KB (-1 B) 589.71 KB
/entity/repository/compare/[entity_id]/[revision_id] 86.11 KB (🟡 +1 B) 189.97 KB
/informatik 157.7 KB (🟡 +1 B) 261.56 KB
/lerntipps 157.7 KB (🟡 +1 B) 261.55 KB
/license/detail/[id] 58.18 KB (🟡 +1 B) 162.04 KB
/mathe 157.69 KB (🟡 +1 B) 261.55 KB
/nachhaltigkeit 157.7 KB (🟡 +1 B) 261.56 KB
/page/create 485.85 KB (-2 B) 589.71 KB
/privacy 40.29 KB (🟡 +1 B) 144.15 KB
/taxonomy/term/create/[parent_id]/[id] 485.61 KB (-2 B) 589.47 KB
/taxonomy/term/update/[id] 485.56 KB (-2 B) 589.41 KB
/user/profile/[username] 177.52 KB (🟡 +1 B) 281.38 KB
/user/settings 484.52 KB (-2 B) 588.38 KB
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

CodingDive commented 1 month ago

Merging now @LarsTheGlidingSquirrel if there should be an issue, we still have time to fix it before upgrading EduSharing :blush: