load("//tools:defaults.bzl", "ng_module")
load("@npm_bazel_typescript//:index.bzl", "ts_devserver")

package(default_visibility = ["//modules/playground:__subpackages__"])

ng_module(
    name = "relative_assets",
    srcs = glob(["**/*.ts"]),
    # This example demonstrates how external resources can be loaded relatively, so we
    # need to disable resource inlining.
    inline_resources = False,
    tsconfig = "//modules/playground:tsconfig-build.json",
    # TODO: FW-1004 Type checking is currently not complete.
    type_check = False,
    deps = [
        "//packages/core",
        "//packages/platform-browser",
        "//packages/platform-browser-dynamic",
        # Needed because the example uses "module.id" in order to load assets relatively.
        "@npm//@types/node",
    ],
)

ts_devserver(
    name = "devserver",
    data = [
        "app/style.css",
        "app/tpl.html",
    ],
    entry_module = "angular/modules/playground/src/relative_assets/index",
    index_html = "index.html",
    port = 4200,
    scripts = [
        "@npm//node_modules/tslib:tslib.js",
        "//tools/rxjs:rxjs_umd_modules",
    ],
    static_files = [
        "@npm//node_modules/zone.js:dist/zone.js",
        "@npm//node_modules/reflect-metadata:Reflect.js",
    ],
    deps = [":relative_assets"],
)
