Skip to content

Commit 22e5b7a

Browse files
committed
Find sourcemap files via glob, and delete .map files in subfolders.
1 parent fa20a31 commit 22e5b7a

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

packages/remix/scripts/deleteSourcemaps.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@
22
const fs = require('fs');
33
const path = require('path');
44

5+
const glob = require('glob');
6+
57
function deleteSourcemaps(buildPath) {
68
console.info(`[sentry] Deleting sourcemaps from ${buildPath}`);
79

8-
const files = fs.readdirSync(buildPath);
10+
// Delete all .map files in the build folder and its subfolders
11+
const mapFiles = glob.sync('**/*.map', { cwd: buildPath });
912

10-
files.forEach(file => {
11-
if (file.endsWith('.map')) {
12-
fs.unlinkSync(path.join(buildPath, file));
13+
mapFiles.forEach(file => {
14+
fs.unlinkSync(path.join(buildPath, file));
1315

14-
console.info(`[sentry] Deleted ${file}`);
15-
}
16+
console.info(`[sentry] Deleted ${file}`);
1617
});
1718
}
1819

0 commit comments

Comments
 (0)