构建 chromium 110 时出错 - 尚不支持将 const 转换为配置的目标环境(“es5”)

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

错误指出:[ERROR] 尚不支持将 const 转换为配置的目标环境(“es5”)

X [ERROR] Transforming const to the configured target environment ("es5") is not supported yet

    gen/third_party/devtools-frontend/src/front_end/entrypoints/formatter_worker/FormatterActions.prebundle.ts:5:7:
      5 Γöé export const enum FormatterActions {
        Γò╡        ~~~~~

  The target environment was set to "es5" here:

    ../../../tsconfig.json:10:14:
      10 Γöé     "target": "es5",
         Γò╡               ~~~~~

X [ERROR] Transforming const to the configured target environment ("es5") is not supported yet

    gen/third_party/devtools-frontend/src/front_end/entrypoints/formatter_worker/FormatterActions.prebundle.ts:13:7:
      13 Γöé export const enum FormattableMediaTypes {
         Γò╡        ~~~~~

  The target environment was set to "es5" here:

    ../../../tsconfig.json:10:14:
      10 Γöé     "target": "es5",
         Γò╡               ~~~~~

X [ERROR] Transforming const to the configured target environment ("es5") is not supported yet

    gen/third_party/devtools-frontend/src/front_end/entrypoints/formatter_worker/FormatterActions.prebundle.ts:23:7:
      23 Γöé export const FORMATTABLE_MEDIA_TYPES: string[] = [
         Γò╡        ~~~~~

  The target environment was set to "es5" here:

    ../../../tsconfig.json:10:14:
      10 Γöé     "target": "es5",
         Γò╡               ~~~~~

X [ERROR] Transforming const to the configured target environment ("es5") is not supported yet

    gen/third_party/devtools-frontend/src/front_end/entrypoints/formatter_worker/FormatterActions.prebundle.ts:43:7:
      43 Γöé export const enum DefinitionKind {
         Γò╡        ~~~~~

  The target environment was set to "es5" here:

    ../../../tsconfig.json:10:14:
      10 Γöé     "target": "es5",
         Γò╡               ~~~~~

[85/51950] CXX obj/third_party/flatbuffers/compiler_files/idl_parser.obj
ninja: build stopped: subcommand failed.
null

知道可能是什么原因吗?

附注实际构建基于 Brave,准确地说是版本 1.48.x - https://github.com/brave/brave-browser/tree/1.48.x 但无论如何,构建错误发生在 chrome 的代码中......

chromium
2个回答
3
投票

同时,我很幸运找到了答案,但我很抱歉在这里提出了这个问题。

答案就在 GitHub 上的 Brave 问题中:https://github.com/brave/brave-browser/issues/21178

基本上在最顶层的 tsconfig.json 文件(包含 chrome 的 src 文件夹的文件夹)中从 es5 更改为 esnext


0
投票

我浏览了

tsconfig.json
并将这些视为配置,

{
  "compilerOptions": {
    "target": "es5",
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": true,
    "noEmit": true,
    "esModuleInterop": true,
    "module": "esnext",
    "moduleResolution": "bundler",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve",
    "incremental": true,
    "plugins": [
      {
        "name": "next"
      }
    ],
    "paths": {
      "@/*": ["./src/*"]
    }
  },
  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
  "exclude": ["node_modules"]
}

我不知道为什么已经给出了 es5 而我正在使用 nextJS 14.0.5

我将

"target": "es5"
更改为
"target": "es2017"
并且成功了! 这是我更改后的 tsconfig.json,

{
  "compilerOptions": {
    "target": "es2017",
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": true,
    "noEmit": true,
    "esModuleInterop": true,
    "module": "esnext",
    "moduleResolution": "bundler",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve",
    "incremental": true,
    "plugins": [
      {
        "name": "next"
      }
    ],
    "paths": {
      "@/*": ["./src/*"]
    }
  },
  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
  "exclude": ["node_modules"]
}
所以,从技术上来说我们需要改变

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