angular - 使用 bazel 在角度应用程序中指定基本 href
问题描述
我正在尝试将 bazel 添加到有角度的应用程序中,但在尝试将应用程序提供给特定 url 时仍然遇到问题。我之前有的是:
ng serve --host 0.0.0.0 --public-host http://localhost:4200/ --poll=500 --base-href /app/ --serve-path /app/
我想用 bazel 做同样的事情,但我做不到。在 ts_devserver 我做了:
ts_devserver(
name = "devserver",
# Serve src/example/index.html at /index.html
additional_root_paths = ["src/example"],
# Run the program from the development version of the main
entry_module = "project/src/main.dev",
# These scripts will be included in the JS bundle after require.js
# They should have only named UMD modules, or require.js will throw.
scripts = [
"@npm//:node_modules/tslib/tslib.js",
":rxjs_umd_modules",
# We are manaully adding the bazel generated named-UMD date-fns bundle here as
# named-UMD bundles for non-APF npm packages are not yet automatically added.
# This file is generated by the npm_umd_bundle @npm//date-fns:date-fns__umd
# rule that is setup by yarn_install.
# "@npm//date-fns:date-fns.umd.js",
],
port = 4200,
serving_path = "/app/",
# Serve these files in addition to the JavaScript bundle
static_files = _ASSETS + [
":inject_scripts_for_dev",
],
# Tell Bazel to build the sources first
deps = ["//src"],
)
在我的 index.html 我有<base href="/app/" />
缺少什么配置,以便我可以在 localhost/app 上为我的应用程序提供服务?
谢谢你。
解决方案
推荐阅读
- python - python - 如何修复python中的“索引超出范围”错误,使用numpy?
- visual-studio-code - VSCode 和 Jenkinsfiles。如何格式化它们?
- javascript - 如何在不使用 JavaScript 中的输入类型文件的情况下读取包含 html 的文本文件?
- sublimetext3 - Sublime Text 3 JavaScript 自动完成
- python - 在 Pandas 中对 DataFrame 进行排序和切片
- node.js - 为什么我在 node.js 中的不和谐机器人在 } 上显示错误?
- r - 如何使用分隔符将两个向量组合成对
- java - 我想生成一个如果有特殊字符不需要转义的XML文件
- spring - sec:authorize 不适用于带有 hasRole(ROLE_ADMIN) 或其他的 thymeleaf
- java - 将 shell 脚本参数添加到 java 应用程序