Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit a6c215a

Browse files
authored
fix: restore getEntryPathRegExp for backward compatibility with older webpack.config.js (#1000)
1 parent c3ed607 commit a6c215a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

index.js

+12
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,18 @@ exports.getAppPath = (platform, projectDir) => {
6060
}
6161
};
6262

63+
/**
64+
* For backward compatibility. This method is deprecated. Do not use it anymore.
65+
* This method also has a bug of not escaping valid regex symbols in entry path.
66+
* For module rules use: "include" instead of "test".
67+
*/
68+
exports.getEntryPathRegExp = (appFullPath, entryModule) => {
69+
const entryModuleFullPath = path.join(appFullPath, entryModule);
70+
// Windows paths contain `\`, so we need to convert each of the `\` to `\\`, so it will be correct inside RegExp
71+
const escapedPath = entryModuleFullPath.replace(/\\/g, "\\\\");
72+
return new RegExp(escapedPath);
73+
}
74+
6375
exports.getSourceMapFilename = (hiddenSourceMap, appFolderPath, outputPath) => {
6476
const appFolderRelativePath = path.join(path.relative(outputPath, appFolderPath));
6577
let sourceMapFilename = "[file].map";

0 commit comments

Comments
 (0)