build: update integration/bazel to Ivy and new rollup_bundle (#33434)

The legacy rollup_bundle will be removed for the rules_nodejs 1.0 release

PR Close #33434
This commit is contained in:
Greg Magolan
2019-10-25 11:52:37 -07:00
committed by Andrew Kushnir
parent 2c623fde16
commit 89704cc5f3
7 changed files with 155 additions and 51 deletions

View File

@ -1,9 +1,10 @@
package(default_visibility = ["//visibility:public"])
load("@npm_angular_bazel//:index.bzl", "ng_module")
load("@build_bazel_rules_nodejs//:index.bzl", "rollup_bundle")
load("@npm//http-server:index.bzl", "http_server")
load("@build_bazel_rules_nodejs//internal/web_package:web_package.bzl", "web_package")
load("@npm_bazel_rollup//:index.bzl", "rollup_bundle")
load("@npm_bazel_terser//:index.bzl", "terser_minified")
load("@npm_bazel_typescript//:index.bzl", "ts_devserver")
# Allow targets under sub-packages to reference the tsconfig.json file
@ -48,29 +49,26 @@ ts_devserver(
rollup_bundle(
name = "bundle",
enable_code_splitting = False,
config_file = "rollup.config.js",
entry_point = ":main.ts",
deps = [
"//src",
# TODO(kyliau): These are not necessary. Bundle compiles fine without
# these deps.
# "@npm//@angular/common",
# "@npm//@angular/core",
# "@npm//@angular/platform-browser",
"@npm//@angular/router", # needed here due to additional imports generated by ngc
"@npm//rxjs",
"@npm//rollup-plugin-commonjs",
"@npm//rollup-plugin-node-resolve",
],
)
terser_minified(
name = "bundle.min",
src = ":bundle",
)
web_package(
name = "prodapp",
assets = [
# do not sort
"@npm//:node_modules/zone.js/dist/zone.min.js",
":bundle.min.js",
],
data = [
":bundle",
":bundle.min",
],
index_html = "index.html",
)

View File

@ -1,4 +1,4 @@
import {platformBrowser} from '@angular/platform-browser';
import {AppModuleNgFactory} from './app.module.ngfactory';
import {AppModule} from './app.module';
platformBrowser().bootstrapModuleFactory(AppModuleNgFactory);
platformBrowser().bootstrapModule(AppModule);

View File

@ -0,0 +1,11 @@
const node = require('rollup-plugin-node-resolve');
const commonjs = require('rollup-plugin-commonjs');
module.exports = {
plugins: [
node({
mainFields: ['browser', 'es2015', 'module', 'jsnext:main', 'main'],
}),
commonjs(),
],
};