Skip to content

Commit 2fbdded

Browse files
committed
5th try fix of sentry to use maps instead of chunks
1 parent da7d744 commit 2fbdded

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

astro.config.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ const standardIntegrations = [
9696
release: {
9797
name: sentryReleaseName,
9898
},
99+
sourcemaps: {
100+
filesToDeleteAfterUpload: ['./dist/**/client/**/*.map', './dist/**/server/**/*.map'],
101+
},
99102
},
100103
})] : []),
101104
sitemap({
@@ -170,9 +173,22 @@ export default defineConfig({
170173
*/
171174
include: ['lit', 'lit/directives/if-defined.js'],
172175
},
176+
/**
177+
* Astro 6 reads `environments.client.build.sourcemap` for client bundles
178+
* instead of the top-level `build.sourcemap` (which only affects server).
179+
* Use 'hidden' to generate .map files without adding //# sourceMappingURL
180+
* comments, so maps are available for Sentry upload but not exposed to users.
181+
*/
182+
environments: {
183+
client: {
184+
build: {
185+
sourcemap: 'hidden',
186+
},
187+
},
188+
},
173189
build: {
174-
/** Source map generation must be turned on for Sentry. */
175-
sourcemap: true,
190+
/** Server source maps for Sentry. */
191+
sourcemap: 'hidden',
176192
rollupOptions: {
177193
onwarn(warning, warn) {
178194
if (shouldSuppressRollupWarning(warning)) return

0 commit comments

Comments
 (0)