Skip to content

Commit e13e13c

Browse files
authored
Merge pull request #1077 from mathjax/pack-messages
Handle pnpm node_module paths better in [node] prefix in messages
2 parents 9f89b3e + 8f0ed33 commit e13e13c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

components/bin/pack

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,11 @@ const bundle = (process.argv[3] || 'bundle');
4040

4141
/**
4242
* @param {string} name The file name to turn into a Regular expression
43+
* @param {string} tail Additional regexp to include after the file path
4344
* @return {RegExp} The regular expression for the name,
4445
*/
45-
function fileRegExp(name) {
46-
return new RegExp(name.replace(/([\\.{}[\]()?*^$])/g, '\\$1'), 'g');
46+
function fileRegExp(name, tail = '') {
47+
return new RegExp(name.replace(/([\\.{}[\]()?*^$])/g, '\\$1') + tail, 'g');
4748
}
4849

4950
/**
@@ -63,7 +64,7 @@ const mjPath = path.dirname(compPath);
6364
const jsPath = path.join(__dirname, '..', '..', target);
6465
const compRE = fileRegExp(compPath);
6566
const rootRE = fileRegExp(path.dirname(jsPath));
66-
const nodeRE = fileRegExp(nodePath);
67+
const nodeRE = fileRegExp(nodePath, '(?:/\\.pnpm/.*?/node_modules)?');
6768
const fontRE = new RegExp('^.*\\/(mathjax-[^\/-]*)(?:-font)?\/(build|[cm]js)');
6869

6970
/**

0 commit comments

Comments
 (0)