Reducing bundle size: globalThis.__DEV__ #2077
-
I was reading through https://www.apollographql.com/docs/react/development-testing/reducing-bundle-size/ and was wondering if anyone had done this before. If so, how can we document this for Angular? Additionally, as Apollo recommends reviewing import style per project, does anyone have any hard evidence to support one style or another in their project? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hey @damienwebdev, have you managed to do it ? |
Beta Was this translation helpful? Give feedback.
-
Turning off development modeSince angular/angular-cli@7f57123, so Angular 17.2, if you are using esbuild builder, then you can add this in your --- angular.json
+++ angular.json
@@ -38,6 +38,9 @@
},
"configurations": {
"production": {
+ "define": {
+ "globalThis.__DEV__": "false"
+ },
"budgets": [
{
"type": "initial", This will save about 6.6 kB, as seen below in a brand new, generated Angular app: Before:
After:
Picking an import styleFor an Angular app, there is no choice. Importing from the main If you use |
Beta Was this translation helpful? Give feedback.
Turning off development mode
Since angular/angular-cli@7f57123, so Angular 17.2, if you are using esbuild builder, then you can add this in your
angular.json
file:This will save about 6.6 kB, as seen below in a brand new, generated Angular app:
Before: