Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: code #825

Merged
merged 1 commit into from Sep 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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,
};