mirror of https://github.com/webpack/webpack.git
				
				
				
			Normalize backslash on windows
This commit is contained in:
		
							parent
							
								
									a0eab48f37
								
							
						
					
					
						commit
						2fe0ba5014
					
				| 
						 | 
				
			
			@ -20,11 +20,12 @@ const hashRegexp = /Hash: [a-f0-9]+/g;
 | 
			
		|||
 | 
			
		||||
exports.replaceBase = (template) => {
 | 
			
		||||
 | 
			
		||||
	let cwd = process.cwd();
 | 
			
		||||
	const cwd = process.cwd();
 | 
			
		||||
	let webpack = path.join(__dirname, "..");
 | 
			
		||||
	let webpackParent = path.join(__dirname, "..", "..");
 | 
			
		||||
	cwd = lessStrict(cwd.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"));
 | 
			
		||||
	cwd = new RegExp(cwd, "g");
 | 
			
		||||
	const cwdRegExpStr = lessStrict(cwd.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"));
 | 
			
		||||
	const cwdRegExp = new RegExp(cwdRegExpStr, "g");
 | 
			
		||||
	const cwdSlashRegExp = new RegExp(cwdRegExpStr + "[\\/\\\\]", "g");
 | 
			
		||||
	webpack = lessStrict(webpack.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"));
 | 
			
		||||
	webpack = new RegExp(webpack, "g");
 | 
			
		||||
	webpackParent = lessStrict(webpackParent.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"));
 | 
			
		||||
| 
						 | 
				
			
			@ -33,7 +34,8 @@ exports.replaceBase = (template) => {
 | 
			
		|||
	return template
 | 
			
		||||
		.replace(/\r\n/g, "\n")
 | 
			
		||||
		.replace(/\r/g, "\n")
 | 
			
		||||
		.replace(cwd, ".")
 | 
			
		||||
		.replace(cwdSlashRegExp, "./")
 | 
			
		||||
		.replace(cwdRegExp, ".")
 | 
			
		||||
		.replace(webpack, "(webpack)")
 | 
			
		||||
		.replace(webpackParent, "(webpack)/~")
 | 
			
		||||
		.replace(timeRegexp, "")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue