gpt4 book ai didi

javascript - 巴泽尔 - 错误 : missing input file '//server:files/src/index.js'

转载 作者:行者123 更新时间:2023-12-01 15:55:42 26 4
gpt4 key购买 nike

我想编译一些 Typescript 文件并从编译的 Javascript 文件创建一个 Node.js 图像。当我只有 一个 带有此 BUILD 文件的 Typescript 文件时,它工作正常:

load("@io_bazel_rules_docker//nodejs:image.bzl", "nodejs_image")
load("@npm_bazel_typescript//:index.bzl", "ts_library")

ts_library(
name = "compile",
srcs = ["src/index.ts"],
)

filegroup(
name = "files",
srcs = ["compile"],
output_group = "es5_sources",
)

nodejs_image(
name = "server",
entry_point = "files",
)

但是一旦我像这样引入多个 Typescript 文件:

load("@io_bazel_rules_docker//nodejs:image.bzl", "nodejs_image")
load("@npm_bazel_typescript//:index.bzl", "ts_library")

ts_library(
name = "compile",
srcs = ["src/index.ts", "src/util.ts"],
)

filegroup(
name = "files",
srcs = ["compile"],
output_group = "es5_sources",
)

nodejs_image(
name = "server",
data = ["files"],
entry_point = "files/src/index.js",
)

Bazel 找不到入口点文件:

ERROR: missing input file '//server:files/src/index.js'
ERROR: /home/flo/Desktop/my-own-minimal-bazel/server/BUILD:15:1: //server:server: missing input file '//server:files/src/index.js'
Target //server:server failed to build
Use --verbose_failures to see the command lines of failed build steps.
ERROR: /home/flo/Desktop/my-own-minimal-bazel/server/BUILD:15:1 1 input file(s) do not exist

最佳答案

如果我将 ts_library 分成两个单独的 ts_libs,一个用于库,一个用于 index.ts,我只能构建 repo:

load("@io_bazel_rules_docker//nodejs:image.bzl", "nodejs_image")
load("@npm_bazel_typescript//:index.bzl", "ts_library")

ts_library(
name = "lib",
srcs = [
"util.ts",
],
)

ts_library(
name = "main",
srcs = [
"index.ts",
],
deps = [":lib"],
)

filegroup(
name = "libfiles",
srcs = ["lib"],
output_group = "es5_sources",
)

filegroup(
name = "mainfile",
srcs = ["main"],
output_group = "es5_sources",
)

nodejs_image(
name = "server",
data = [
":libfiles",
":mainfile",
],
entry_point = ":mainfile",
)

以上代码在对您的存储库的拉取请求中。我不确定为什么您无法引用文件组的单个文件!

关于javascript - 巴泽尔 - 错误 : missing input file '//server:files/src/index.js' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59233973/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com