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

初始化运行npm start报正则不合法的错误 #7381

Closed
xinyouhunran opened this issue Sep 22, 2020 · 0 comments · Fixed by umijs/umi#5462
Closed

初始化运行npm start报正则不合法的错误 #7381

xinyouhunran opened this issue Sep 22, 2020 · 0 comments · Fixed by umijs/umi#5462

Comments

@xinyouhunran
Copy link

xinyouhunran commented Sep 22, 2020

实验项目均为重新按照官方文档流程新建立的,而不是老项目。
SyntaxError: Invalid regular expression: /(node_modules|D:\workspace\antTest\dist)/: Unterminated group
at new RegExp ()
at Bundler.setupDevServerOpts (D:\workspace\antTest\node_modules_@umijs_bundler-webpack@3.2.21@@umijs\bundler-webpack\lib\index.js:150:69)

经定位是上述index.js中正则拼接的错误,代码片段:
watchOptions: {
// not watch outputPath dir and node_modules
ignored: process.env.WATCH_IGNORED === 'none' ? undefined : new RegExp(process.env.WATCH_IGNORED || (node_modules|${absOutputPath}${_path().sep}))
}
由于${absOutputPath}${_path().sep}=D:\workspace\antTest\dist\中存在\特殊字符,导致生成正则错误,如果只针对开发,可以将后续拼接删除或者变成${absOutputPath}${_path().sep}.*,但觉得不妥,想问问有遇到这个问题的吗,如何解决。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant