Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions contrib/nextjs/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,17 @@ def nextjs_standalone_build(name, config, srcs, next_js_binary, data = [], **kwa
**kwargs: Other attributes passed to all targets such as `tags`, env
"""

copy_file(
name = "_%s.original_config_file" % name,
src = config,
out = "__original.%s" % config,
visibility = ["//visibility:private"],
tags = ["manual"],
)

# Wrap the config file to add necessary bazel logic
env = kwargs.pop("env", {})
env["NEXTJS_STANDALONE_CONFIG"] = "$(locations %s)" % config
env["NEXTJS_STANDALONE_CONFIG"] = "$(locations _%s.original_config_file)" % name
copy_file(
name = "_%s.standalone_config_file" % name,
src = _next_standalone_config,
Expand All @@ -309,7 +317,10 @@ def nextjs_standalone_build(name, config, srcs, next_js_binary, data = [], **kwa
tool = next_js_binary,
env = env,
args = ["build"],
srcs = srcs + data + [":_%s.standalone_config_file" % name, config],
srcs = srcs + data + [
":_%s.standalone_config_file" % name,
"_%s.original_config_file" % name,
],
out_dirs = [_next_build_out],
chdir = native.package_name(),
mnemonic = "NextJs",
Expand Down
Loading