`^`在Webpack DevServer Proxy pathRewrite中是什么意思?

问题描述 投票:0回答:1

我想了解的是 Webpack DevServer Proxy文档.

我的目标是代理任何不含.html的路径到对应的 .html 文件。例子。/foo -> /foo.html/bar -> /bar.html

我想,我需要用 pathRewrites. 文件中的例子建议将路径改写为 pathRewrite: {'^/api' : ''}.

我还不清楚(第一个参数的)语法。句号的意思是什么?^)字符?是Regexp吗?语法文档在哪里?

webpack proxy configuration webpack-dev-server
1个回答
0
投票

找到了。

开发服务器使用了强大的http -proxy -middleware包。

该包定义了

对象键将作为RegExp来匹配路径。

-> 是的,这是一个Regexp。✅

© www.soinside.com 2019 - 2024. All rights reserved.