flo*_*olu 3 javascript node.js typescript bazel
我想编译一些 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",
)
Run Code Online (Sandbox Code Playgroud)
但是一旦我像这样引入多个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",
)
Run Code Online (Sandbox Code Playgroud)
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
Run Code Online (Sandbox Code Playgroud)
I can only get the repo to build if I break up the ts_library into two seperate ts_libs, one for the library, and one for the index.ts:
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",
)
Run Code Online (Sandbox Code Playgroud)
The above code is in a pull request to your repo. I'm not sure why you are unable to reference a single file of the filegroup!
归档时间: |
|
查看次数: |
1598 次 |
最近记录: |