nuxt-community / sentry-module

Sentry module for Nuxt 2
https://sentry.nuxtjs.org
MIT License
500 stars 113 forks source link

fix: significantly reduce client bundle size #532

Closed rchl closed 1 year ago

rchl commented 1 year ago

The import * as Sentry from '~@sentry/vue' has prevented tree shaking from working.

This results in about 221KB reduction when using tracing and a bit less when not using tracing (that's weird, yes, but looks like related to Sentry SDK itself).

Unfortunately it doesn't benefit when using lazy loading. Maybe there is a way to handle it using webpack's magic comments in https://github.com/nuxt-community/sentry-module/blob/994f333a8dfbc8cb4ecefbbc8042752d804b7f64/src/templates/plugin.lazy.js#L112-L112 but I haven't investigated at that point.

EDIT: There is a webpack magic comment webpackExports but it's only available from webpack 5.