analogjs / analog

The fullstack meta-framework for Angular. Powered by Vite and Nitro
https://analogjs.org
MIT License
2.5k stars 240 forks source link

chore: add perf changes from esbuild browser plugin #14

Closed brandonroberts closed 2 years ago

brandonroberts commented 2 years ago

Adds checks to see if babel transform is needed

https://github.com/angular/angular-cli/pull/23682

pjlamb12 commented 2 years ago

I'm unsure where the change that starts on line 371 of that PR should be added in Analog. My guess is in the object whose name is name: '@analogjs/vite-plugin-angular-optimizer' in the angular-vite-plugin.ts file, inside the transform method?

pjlamb12 commented 2 years ago

These are the changes I've begun making. I haven't worked with esbuild (or anything similar) before so I know this may need to change.

brandonroberts commented 2 years ago

@pjlamb12 Thanks! Looking on track so far. You don't need to add the advancedOptimizations flag. Just use the isProd boolean that already exists inside the plugin. These changes would be added to both the @analogjs/vite-plugin-angular-optimizer and @analogjs/vite-plugin-angular transform functions.

Would be cleaner to separate the plugins into different files, but that can come as a separate effort.