Skip to content

Commit

Permalink
refactor: code (#825)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Sep 6, 2021
1 parent 7b32255 commit 885e739
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
5 changes: 0 additions & 5 deletions src/index.js
Expand Up @@ -11,7 +11,6 @@ import {
AUTO_PUBLIC_PATH,
ABSOLUTE_PUBLIC_PATH,
SINGLE_DOT_PATH_SEGMENT,
DOUBLE_DOT_PATH_SEGMENT,
compareModulesByIdentifier,
} from "./utils";

Expand Down Expand Up @@ -1042,10 +1041,6 @@ class MiniCssExtractPlugin {
new RegExp(SINGLE_DOT_PATH_SEGMENT, "g"),
"."
);
content = content.replace(
new RegExp(DOUBLE_DOT_PATH_SEGMENT, "g"),
".."
);
content = content.replace(new RegExp(AUTO_PUBLIC_PATH, "g"), undoPath);

if (module.sourceMap) {
Expand Down
8 changes: 4 additions & 4 deletions src/loader.js
Expand Up @@ -6,7 +6,6 @@ import {
AUTO_PUBLIC_PATH,
ABSOLUTE_PUBLIC_PATH,
SINGLE_DOT_PATH_SEGMENT,
DOUBLE_DOT_PATH_SEGMENT,
stringifyRequest,
} from "./utils";
import schema from "./loader-options.json";
Expand Down Expand Up @@ -199,9 +198,10 @@ export function pitch(request) {
const isAbsolutePublicPath = /^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(publicPath);
const publicPathForExtract = isAbsolutePublicPath
? publicPath
: `${ABSOLUTE_PUBLIC_PATH}${publicPath
.replace(/\./g, SINGLE_DOT_PATH_SEGMENT)
.replace(/\.\./g, DOUBLE_DOT_PATH_SEGMENT)}`;
: `${ABSOLUTE_PUBLIC_PATH}${publicPath.replace(
/\./g,
SINGLE_DOT_PATH_SEGMENT
)}`;

this.importModule(
`${this.resourcePath}.webpack[javascript/auto]!=!${request}`,
Expand Down
3 changes: 0 additions & 3 deletions src/utils.js
Expand Up @@ -57,8 +57,6 @@ const AUTO_PUBLIC_PATH = "__mini_css_extract_plugin_public_path_auto__";
const ABSOLUTE_PUBLIC_PATH = "webpack:///mini-css-extract-plugin/";
const SINGLE_DOT_PATH_SEGMENT =
"__mini_css_extract_plugin_single_dot_path_segment__";
const DOUBLE_DOT_PATH_SEGMENT =
"__mini_css_extract_plugin_double_dot_path_segment__";

function isAbsolutePath(str) {
return path.posix.isAbsolute(str) || path.win32.isAbsolute(str);
Expand Down Expand Up @@ -113,6 +111,5 @@ export {
AUTO_PUBLIC_PATH,
ABSOLUTE_PUBLIC_PATH,
SINGLE_DOT_PATH_SEGMENT,
DOUBLE_DOT_PATH_SEGMENT,
stringifyRequest,
};

0 comments on commit 885e739

Please sign in to comment.