模板字符串中不允许使用八进制转义序列

hak*_*bhd 6 node.js npm electron electron-builder vue-cli-3

我正在使用电子和 vue构建一个桌面应用程序,一切正常,在开发模式下运行该应用程序并通过运行构建它直到最后一个构建,electron:build但我不断收到Octal 转义序列的错误。

我很确定它必须处理strict mode,但我试图找到 ocatal 转义但没有机会,我试图删除一些无用的依赖项,我在上次成功构建后添加的也没有工作


PS:电子:服务工作正常

错误图片

在此处输入图片说明

模板字符串中不允许来自 Terser Octal 转义序列的 background.js [background.js:1026,68555]

错误 构建失败并出现错误。npm 错误!代码 ELIFECYCLE npm ERR!错误号 1 npm 错误号!键盘管理vue-cli-service electron:build @0.1.0电子:构建:npm ERR!退出状态 1 npm ERR!npm 错误!在键盘管理@0.1.0 电子:构建脚本失败。npm 错误!这可能不是 npm 的问题。上面可能有额外的日志输出。

Mat*_*son 10

问题出在background.js 中。在第 1026 行和第 68555 行中,查找其中包含八进制序列的模板字符串。例子:

console.log(`Octal sequences like \033 are not allowed here`)
Run Code Online (Sandbox Code Playgroud)

您可以将 es6 模板恢复为(常规)字符串:

console.log("Octal sequences like \033 are allowed here")
Run Code Online (Sandbox Code Playgroud)

或者您可以尝试不同的允许的编码,例如

console.log(`Sequences like \2264 are not allowed here`);
console.log(`But sequences like \u2264 are allowed`);
Run Code Online (Sandbox Code Playgroud)