Skip to content

Commit

Permalink
[dev-tool] try / and \ path separators when checking bundling war…
Browse files Browse the repository at this point in the history
…nings (#24386)

It turns out that on windows some warnings are reported with `\`
separator while others with `/` at the same time, e.g.,

str
../../../common/temp/node_modules/.pnpm/[email protected]/node_modules/chai/lib/chai.js
str
C:\github\jeremymeng\js-main\common\temp\node_modules\.pnpm\[email protected]\node_modules\sinon\pkg\sinon-esm.js

This PR changes to try both separators when checking whether to suppress
bundle warnings.

---------

Co-authored-by: Will Temple <[email protected]>
  • Loading branch information
jeremymeng and witemple-msft authored Feb 24, 2023
1 parent 199a67a commit c8b48fe
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions common/tools/dev-tool/src/config/rollup.base.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ export function sourcemapsExtra() {
export type WarningInhibitor = (warning: RollupWarning) => boolean;

function matchesPathSegments(str: string | undefined, segments: string[]): boolean {
// Reported warnings use "/"
return str?.includes(segments.join("/")) ?? false;
return !str ? false : str.includes(segments.join("/")) || str.includes(segments.join("\\"));
}

function ignoreNiseSinonEval(warning: RollupWarning): boolean {
Expand Down

0 comments on commit c8b48fe

Please sign in to comment.