Skip to content

Commit 0b42fbf

Browse files
committed
reuse normalize func
1 parent beee097 commit 0b42fbf

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/nextjs/src/config/getBuildPluginOptions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ type BuildTool = keyof typeof LOGGER_PREFIXES;
4747
/**
4848
* Normalizes Windows paths to POSIX format for glob patterns
4949
*/
50-
function normalizePathForGlob(distPath: string): string {
50+
export function normalizePathForGlob(distPath: string): string {
5151
return distPath.replace(/\\/g, '/');
5252
}
5353

packages/nextjs/src/config/webpack.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import * as fs from 'fs';
77
import * as path from 'path';
88
import { sync as resolveSync } from 'resolve';
99
import type { VercelCronsConfig } from '../common/types';
10-
import { getBuildPluginOptions } from './getBuildPluginOptions';
10+
import { getBuildPluginOptions, normalizePathForGlob } from './getBuildPluginOptions';
1111
import type { RouteManifest } from './manifest/types';
1212
// Note: If you need to import a type from Webpack, do it in `types.ts` and export it from there. Otherwise, our
1313
// circular dependency check thinks this file is importing from itself. See https://github.com/pahen/madge/issues/306.
@@ -418,8 +418,8 @@ export function constructWebpackConfigFunction({
418418
newConfig.plugins = newConfig.plugins || [];
419419
const { config: userNextConfig, dir, nextRuntime } = buildContext;
420420
const buildTool = isServer ? (nextRuntime === 'edge' ? 'webpack-edge' : 'webpack-nodejs') : 'webpack-client';
421-
const projectDir = dir.replace(/\\/g, '/');
422-
const distDir = (userNextConfig as NextConfigObject).distDir?.replace(/\\/g, '/') ?? '.next';
421+
const projectDir = normalizePathForGlob(dir);
422+
const distDir = normalizePathForGlob((userNextConfig as NextConfigObject).distDir ?? '.next');
423423
const distDirAbsPath = path.posix.join(projectDir, distDir);
424424

425425
const sentryWebpackPluginInstance = sentryWebpackPlugin(

0 commit comments

Comments
 (0)