Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
27 lines
1.1 KiB
Plaintext
27 lines
1.1 KiB
Plaintext
import { defineIntegration, escapeStringForRegex, rewriteFramesIntegration } from '@sentry/core';
|
|
import * as path from 'path';
|
|
|
|
const distDirRewriteFramesIntegration = defineIntegration(({ distDirName }) => {
|
|
// nextjs always puts the build directory at the project root level, which is also where you run `next start` from, so
|
|
// we can read in the project directory from the currently running process
|
|
const distDirAbsPath = path.resolve(distDirName).replace(/(\/|\\)$/, ''); // We strip trailing slashes because "app:///_next" also doesn't have one
|
|
|
|
// eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor -- user input is escaped
|
|
const SOURCEMAP_FILENAME_REGEX = new RegExp(escapeStringForRegex(distDirAbsPath));
|
|
|
|
const rewriteFramesInstance = rewriteFramesIntegration({
|
|
iteratee: frame => {
|
|
frame.filename = frame.filename?.replace(SOURCEMAP_FILENAME_REGEX, 'app:///_next');
|
|
return frame;
|
|
},
|
|
});
|
|
|
|
return {
|
|
...rewriteFramesInstance,
|
|
name: 'DistDirRewriteFrames',
|
|
};
|
|
});
|
|
|
|
export { distDirRewriteFramesIntegration };
|
|
//# sourceMappingURL=distDirRewriteFramesIntegration.js.map
|