diff --git a/src/e2e-app/BUILD.bazel b/src/e2e-app/BUILD.bazel new file mode 100644 index 000000000000..b2e3e9350e2c --- /dev/null +++ b/src/e2e-app/BUILD.bazel @@ -0,0 +1,58 @@ +package(default_visibility=["//visibility:public"]) + +load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver") +load("//tools:defaults.bzl", "ng_module") + +ng_module( + name = "e2e-app", + srcs = glob(["**/*.ts"]), + assets = glob(["**/*.html", "**/*.css"], exclude = ["index.html"]), + deps = [ + "@angular//packages/core", + "@angular//packages/forms", + "@angular//packages/platform-browser", + "@angular//packages/platform-browser/animations", + "@angular//packages/router", + "//src/cdk/drag-drop", + "//src/cdk/overlay", + "//src/cdk/scrolling", + # TODO(devversion): be more explicit by using "@angular/material" with individual entry points. + "//src/lib:material", + "//src/material-examples:examples", + "//src/cdk-experimental/dialog", + "//src/cdk-experimental/scrolling", + ], +) + +ts_devserver( + name = "devserver", + port = 4200, + # Name of the AMD module that should be required on page load. + entry_module = "angular_material/src/e2e-app/main", + # Serving path of the bundle that serves all files specified in "deps" and "scripts". + serving_path = "/bundle.js", + # Root paths can be used simplify the loading of files from external Bazel repositories + # (such as the Bazel managed deps repository called "matdeps") + additional_root_paths = [ + "angular_material/", + "matdeps/node_modules", + ], + # Files which should be provided by Bazel when running the devserver. These are not + # automatically served, but can be loaded manually through HTTP requests. + static_files = [ + "@matdeps//zone.js", + "@matdeps//core-js", + "@matdeps//hammerjs", + "//src/lib/prebuilt-themes:indigo-pink", + ":index.html", + ], + # Scripts which will be included in the serving_path bundle after "require.js" has been + # loaded. + scripts = [ + ":devserver-configure.js", + "@matdeps//node_modules/tslib:tslib.js", + ], + # Dependencies that produce JavaScript output will be automatically included in the + # serving_path bundle + deps = [":e2e-app"], +) diff --git a/src/e2e-app/devserver-configure.js b/src/e2e-app/devserver-configure.js new file mode 100644 index 000000000000..4d0a13973c62 --- /dev/null +++ b/src/e2e-app/devserver-configure.js @@ -0,0 +1,10 @@ +// We need to configure AMD modules which are not named because otherwise "require.js" is not +// able to resolve AMD imports to such modules. +require.config({ + paths: { + 'moment': 'moment/min/moment.min' + } +}); + +// Workaround until https://github.com/angular/material2/issues/13883 has been addressed. +var module = {id: ''}; diff --git a/src/e2e-app/index.html b/src/e2e-app/index.html index 503071049caf..557aadcf2cce 100644 --- a/src/e2e-app/index.html +++ b/src/e2e-app/index.html @@ -9,7 +9,7 @@ - + @@ -17,15 +17,12 @@