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

fix: restore getEntryPathRegExp for backward compatibility with older… #1000

Merged
merged 1 commit into from
Jul 23, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,18 @@ exports.getAppPath = (platform, projectDir) => {
}
};

/**
* For backward compatibility. This method is deprecated. Do not use it anymore.
* This method also has a bug of not escaping valid regex symbols in entry path.
* For module rules use: "include" instead of "test".
*/
exports.getEntryPathRegExp = (appFullPath, entryModule) => {
const entryModuleFullPath = path.join(appFullPath, entryModule);
// Windows paths contain `\`, so we need to convert each of the `\` to `\\`, so it will be correct inside RegExp
const escapedPath = entryModuleFullPath.replace(/\\/g, "\\\\");
return new RegExp(escapedPath);
}

exports.getSourceMapFilename = (hiddenSourceMap, appFolderPath, outputPath) => {
const appFolderRelativePath = path.join(path.relative(outputPath, appFolderPath));
let sourceMapFilename = "[file].map";
Expand Down