Skip to content

Commit

Permalink
Merge pull request #4494 from iclanton/fix-hashed-folder-copy-plugin-…
Browse files Browse the repository at this point in the history
…windows

[hashed-folder-copy-webpack-plugin] Fix hashed-folder-copy-plugin on Windows.
  • Loading branch information
iclanton authored Jan 25, 2024
2 parents 38bf11d + 357ce3b commit 769b55a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@rushstack/hashed-folder-copy-plugin",
"comment": "Fix an issue where builds running on Windows and not on the C drive would not discover assets.",
"type": "patch"
}
],
"packageName": "@rushstack/hashed-folder-copy-plugin"
}
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ function _getHashedFolderDependencyForWebpackInstance(webpack: typeof import('we
compilation.errors.push(new webpack.WebpackError(errorMessage));
return renderError(errorMessage);
} else {
resolvedGlobsBase = path.posix.resolve(context, globsBase);
resolvedGlobsBase = path.resolve(context, globsBase);
}
} else if (path.isAbsolute(globsBase)) {
// This is an absolute path
Expand Down Expand Up @@ -213,7 +213,7 @@ function _getHashedFolderDependencyForWebpackInstance(webpack: typeof import('we
}

if (packagePath) {
resolvedGlobsBase = path.posix.join(packagePath, pathInsidePackage);
resolvedGlobsBase = path.join(packagePath, pathInsidePackage);
} else {
const errorMessage: string = `Unable to resolve package "${packageName}"`;
compilation.errors.push(new webpack.WebpackError(errorMessage));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.

jest.mock('node:path', () => {
const path: typeof import('path') = jest.requireActual('path');
return path.posix;
});

jest.mock(
'fast-glob/out/providers/provider',
() => {
const path: typeof import('path') = require('path');
const path: typeof import('path') = jest.requireActual('path');
const { default: provider } = jest.requireActual('fast-glob/out/providers/provider');
provider.prototype._getRootDirectory = function (task: { base: string }) {
// fast-glob calls `path.resolve` which doesn't work correctly with the MemFS volume while running on Windows
Expand Down

0 comments on commit 769b55a

Please sign in to comment.