GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Normalize backslash on windows · webpack/webpack@2fe0ba5

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • examples
    • template-common.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎examples/template-common.js‎

Copy file name to clipboardExpand all lines: examples/template-common.js
+6-4Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ const hashRegexp = /Hash: [a-f0-9]+/g;
2020

2121
exports.replaceBase = (template) => {
2222

23-
let cwd = process.cwd();
23+
const cwd = process.cwd();
2424
let webpack = path.join(__dirname, "..");
2525
let webpackParent = path.join(__dirname, "..", "..");
26-
cwd = lessStrict(cwd.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"));
27-
cwd = new RegExp(cwd, "g");
26+
const cwdRegExpStr = lessStrict(cwd.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"));
27+
const cwdRegExp = new RegExp(cwdRegExpStr, "g");
28+
const cwdSlashRegExp = new RegExp(cwdRegExpStr + "[\\/\\\\]", "g");
2829
webpack = lessStrict(webpack.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"));
2930
webpack = new RegExp(webpack, "g");
3031
webpackParent = lessStrict(webpackParent.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"));
@@ -33,7 +34,8 @@ exports.replaceBase = (template) => {
3334
return template
3435
.replace(/\r\n/g, "\n")
3536
.replace(/\r/g, "\n")
36-
.replace(cwd, ".")
37+
.replace(cwdSlashRegExp, "./")
38+
.replace(cwdRegExp, ".")
3739
.replace(webpack, "(webpack)")
3840
.replace(webpackParent, "(webpack)/~")
3941
.replace(timeRegexp, "")

0 commit comments

Comments
0 (0)
You are visitor 01402622 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.