模板字符串中不允许使用八进制转义序列
我正在使用 electron 和 vue 构建桌面应用程序,一切正常,在开发模式下运行该应用程序并通过运行
electron:build
构建它直到最后一个构建,但我不断收到 Octal escape sequences. 的错误
我很确定它必须处理
strict mode
,但我试图找到八进制转义但没有机会,我试图删除一些我在上次成功构建后添加的无用依赖项也没有用
PS:electron:serve 工作正常
错误的图片
回答如下:background.js 来自 Terser 模板字符串中不允许使用八进制转义序列 [background.js:1026,68555]
ERROR 构建因错误而失败。 错误!代码生命周期 错误!错误号 1 错误!键盘管理@0.1.0 电子:构建:
错误!退出状态 1 错误! 错误!在 [email protected] electron:build 脚本中失败。 错误!这可能不是 npm 的问题。上面可能有额外的日志输出。vue-cli-service electron:build
问题出在background.js。在第 1026 行和第 68555 行中,查找其中包含八进制序列的模板字符串。例子:
console.log(`Octal sequences like \033 are not allowed here`)
您可以将 es6 模板恢复为(常规)字符串:
console.log("Octal sequences like \033 are allowed here")
或者您可以尝试 不同的、允许的编码,例如,
console.log(`Sequences like \2264 are not allowed here`);
console.log(`But sequences like \u2264 are allowed`);