狠狠撸

狠狠撸Share a Scribd company logo
按一下以編輯母片標題樣式
按一下以編輯母片子標題樣式
我是[黃保翕]
Will 保哥
多奇數位創意有限公司 技術總監
https://blog.miniasp.com
Find me at
https://www.facebook.com/will.fans
按一下以編輯母片標題樣式
按一下以編輯母片子標題樣式
Micro-frontend with
Angular 10
Will 保哥
Micro-frontends with Angular 10
使用 Angular 10 實現微前端
Implementing Micro-frontends with Angular 10
將元件整合進不同的前端框架
Integrate Angular 10 components into other frameworks
何謂微前端
What is Micro-frontends?
Micro-frontends with Angular 10
使用 Angular 10 實現微前端
Implementing Micro-frontends with Angular 10
將元件整合進不同的前端框架Integrate Angular 10 components into other frameworks
何謂微前端
What is Micro-frontends?
微前端 (Micro Frontends)
? 最早出現於 2016 年 ThoughtWorks 的技術雷達
? 借用 微服務架構 (Microservices) 許多概念與作法
? 有效解構大型前端架構下的各種相依、協作、整合等問題
? Be Technology Agnostic(不限定各團隊所採用的前端技術)
? Isolate Team Code(不同的團隊代碼必須彼此隔離以降低相依性)
? Establish Team Prefixes(建立團隊之間的命名規則以降低資源衝突)
? Favor Native Browser Features over Custom APIs(使用原生 API 為
主)
? Build a Resilient Site(建置有高度彈性、遇到錯誤可迅速回復的站台)
將頁面分割為不同的 Web 元件
https://www.toptal.com/front-end/micro-frontends-strengths-benefits
套用微前端架構的 HTML 結構範例
可動態載入外部 JS 檔案
自訂元素 (Custom Elements)
Custom Elements (V1)
Micro-frontends with Angular 10
使用 Angular 10 實現微前端
Implementing Micro-frontends with Angular 10
將元件整合進不同的前端框架Integrate Angular 10 components into other frameworks
何謂微前端
What is Micro-frontends?
初始化專案
? ng new --create-application=false mfdemo1 && cd mfdemo1
? ng g application mfdemo1 --routing --style=css
? ng g application mf-element1 --routing=false --style=css
? ng add @angular/elements --project=mf-element1
? ng add ngx-build-plus --project=mf-element1
移除 AppComponent 的 selector 屬性
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'mf-element1';
}
移除 AppModule 的 bootstrap 屬性
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule
],
providers: []
, bootstrap: [AppComponent]
})
export class AppModule { … }
加入 AppModule 的 ngDoBootstrap()
import { Injector } from '@angular/core';
import { createCustomElement } from '@angular/elements';
@NgModule(…)
export class AppModule {
constructor(private injector: Injector) {}
ngDoBootstrap(): void {
const customElement = createCustomElement(AppComponent, { injector: this.injector });
customElements.define('mf-element1', customElement);
}
}
關於 Polyfills 設定
? 使用於 non-Angular 網頁環境需額外載入 zone.js 才能執行
? node_modules/zone.js/dist/zone.min.js
? 針對不支援 Custom Elements (V1) 的瀏覽器提供 Polyfills
(IE11)
? 在執行 ng add @angular/elements 的時候會自動加入 document-register-element 套件
? node_modules/document-register-element/build/document-register-element.js
? 其他可能需要的 Polyfills 套件
? ng g ngx-build-plus:wc-polyfill --project mf-element1
? npm install core-js@2
建置專案
? ng build --project=mfdemo1 --prod --output-hashing=none
? ng build --project=mf-element1 --prod --output-hashing=none --single-bundle
mfdemo1 mf-element1 說明
3rdpartylicenses.txt 3rdpartylicenses.txt 所有套件的授權聲明
favicon1.ico favicon1.ico 網站的 Favicon 圖檔
index.html index.html 網站預設首頁
main.js main.js 主要程式
runtime.js 內容被合併至 main.js 執行 Angular 所需的共用程式
polyfills.js polyfills.js 支援舊版瀏覽器所需的 Polyfills
styles.css styles.css 全站共用的 CSS 內容
部署 Angular Elements 與 Polyfills
? 複製主程式與 Polyfills
? cp dist/mf-element1/main.js dist/mfdemo1/mf-element1.js
? cp dist/mf-element1/polyfills.js dist/mfdemo1/mf-polyfills.js
? 僅複製必要的 zone.js 與 document-register-element.js
? cp node_modules/zone.js/dist/zone.min.js dist/mf-element1/zone.min.js
? cp node_modules/document-register-element/build/document-register-element.js dist/mf-
element1/document-register-element.js
? 注意事項:請不要在 main.ts 匯入 zone.js
? import 'zone.js/dist/zone';
? Configuring CommonJS dependencies
Micro-frontends with Angular 10
使用 Angular 10 實現微前端
Implementing Micro-frontends with Angular 10
將元件整合進不同的前端框架Integrate Angular 10 components into other frameworks
何謂微前端
What is Micro-frontends?
非 Angular 網頁嵌入 Angular Elements
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Mfdemo1</title>
</head>
<body>
<mf-element1></mf-element1>
<script src=/slideshow/microfrontends-with-angular-10/239038336/"mf-polyfills.js" defer></script>
<script src="mf-element1.js" defer></script>
</body>
</html>
非 Angular 網頁嵌入 Angular Elements
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Mfdemo1</title>
</head>
<body>
<mf-element1></mf-element1>
<script src=/slideshow/microfrontends-with-angular-10/239038336/"zone.min.js" defer></script>
<script src="mf-element1.js" defer></script>
</body>
</html>
從 Angular 載入 Angular Elements
? 安裝 Angular Extensions Elements 套件
? npm i @angular-extensions/elements
? 匯入 LazyElementsModule 至 AppModule 的 imports 屬性
? import { LazyElementsModule } from '@angular-extensions/elements';
? 加入 CUSTOM_ELEMENTS_SCHEMA 至 AppModule 的 schemas 屬性
? schemas: [CUSTOM_ELEMENTS_SCHEMA]
? 使用 *axLazyElement 結構型指令
? <mf-element1 *axLazyElement="'/mf-element1.js'"></mf-element1>
? The Best Way To Lazy Load Angular Elements | by Tomas Trajan
? Angular Elements Demo
按一下以編輯母片標題樣式
按一下以編輯母片子標題樣式
歡迎將
講者照片
裁成圓形
置於此處
我是[黃保翕]
Will 保哥
多奇數位創意有限公司 技術總監
https://blog.miniasp.com
Find me at
https://www.facebook.com/will.fans

More Related Content

What's hot (20)

Vue.js
Vue.jsVue.js
Vue.js
Jadson Santos
?
進擊的前端工程師:今天就用 JSON Server 自己打造 API 吧!
進擊的前端工程師:今天就用 JSON Server 自己打造 API 吧!進擊的前端工程師:今天就用 JSON Server 自己打造 API 吧!
進擊的前端工程師:今天就用 JSON Server 自己打造 API 吧!
Will Huang
?
Arquitetura Node com NestJSArquitetura Node com NestJS
Arquitetura Node com NestJS
Vanessa Me Tonini
?
笔丑辫をいじり倒す10の方法
笔丑辫をいじり倒す10の方法笔丑辫をいじり倒す10の方法
笔丑辫をいじり倒す10の方法
Moriyoshi Koizumi
?
Express node js
Express node jsExpress node js
Express node js
Yashprit Singh
?
Jenkins as a Service - Code all the way down
Jenkins as a Service - Code all the way downJenkins as a Service - Code all the way down
Jenkins as a Service - Code all the way down
Steve Mactaggart
?
Nodejs - A performance que eu sempre quis terNodejs - A performance que eu sempre quis ter
Nodejs - A performance que eu sempre quis ter
Emerson Macedo
?
WebAssembly Overview
WebAssembly OverviewWebAssembly Overview
WebAssembly Overview
Alexandr Skachkov
?
入社1年目のプログラミング初心者が厂辫谤颈苍驳を学ぶための手引き
入社1年目のプログラミング初心者が厂辫谤颈苍驳を学ぶための手引き入社1年目のプログラミング初心者が厂辫谤颈苍驳を学ぶための手引き
入社1年目のプログラミング初心者が厂辫谤颈苍驳を学ぶための手引き
土岐 孝平
?
Introduction to NodeJS
Introduction to NodeJSIntroduction to NodeJS
Introduction to NodeJS
Cere Labs Pvt. Ltd
?
Introduction to RxJS
Introduction to RxJSIntroduction to RxJS
Introduction to RxJS
Brainhub
?
Micrometerでメトリクスを収集してAmazon CloudWatchで可視化
Micrometerでメトリクスを収集してAmazon CloudWatchで可視化Micrometerでメトリクスを収集してAmazon CloudWatchで可視化
Micrometerでメトリクスを収集してAmazon CloudWatchで可視化
Ryosuke Uchitate
?
Angular
AngularAngular
Angular
TejinderMakkar
?
厂辫谤颈苍驳を使った飞别产アプリにリファクタリングしよう
厂辫谤颈苍驳を使った飞别产アプリにリファクタリングしよう厂辫谤颈苍驳を使った飞别产アプリにリファクタリングしよう
厂辫谤颈苍驳を使った飞别产アプリにリファクタリングしよう
土岐 孝平
?
How WebAssembly is changing the Web and what it means for Angular
How WebAssembly is changing the Web and what it means for AngularHow WebAssembly is changing the Web and what it means for Angular
How WebAssembly is changing the Web and what it means for Angular
Boyan Mihaylov
?
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...
Edureka!
?
gRPC on .NET Core - NDC Sydney 2019
gRPC on .NET Core - NDC Sydney 2019gRPC on .NET Core - NDC Sydney 2019
gRPC on .NET Core - NDC Sydney 2019
James Newton-King
?
"How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie...
"How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie..."How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie...
"How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie...
Fwdays
?
闯别苍办颈苍蝉使ってみた~奥颈苍诲辞飞蝉编~
闯别苍办颈苍蝉使ってみた~奥颈苍诲辞飞蝉编~闯别苍办颈苍蝉使ってみた~奥颈苍诲辞飞蝉编~
闯别苍办颈苍蝉使ってみた~奥颈苍诲辞飞蝉编~
Yuta Matsumura
?
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.js
Dinesh U
?
進擊的前端工程師:今天就用 JSON Server 自己打造 API 吧!
進擊的前端工程師:今天就用 JSON Server 自己打造 API 吧!進擊的前端工程師:今天就用 JSON Server 自己打造 API 吧!
進擊的前端工程師:今天就用 JSON Server 自己打造 API 吧!
Will Huang
?
Arquitetura Node com NestJSArquitetura Node com NestJS
Arquitetura Node com NestJS
Vanessa Me Tonini
?
笔丑辫をいじり倒す10の方法
笔丑辫をいじり倒す10の方法笔丑辫をいじり倒す10の方法
笔丑辫をいじり倒す10の方法
Moriyoshi Koizumi
?
Jenkins as a Service - Code all the way down
Jenkins as a Service - Code all the way downJenkins as a Service - Code all the way down
Jenkins as a Service - Code all the way down
Steve Mactaggart
?
Nodejs - A performance que eu sempre quis terNodejs - A performance que eu sempre quis ter
Nodejs - A performance que eu sempre quis ter
Emerson Macedo
?
入社1年目のプログラミング初心者が厂辫谤颈苍驳を学ぶための手引き
入社1年目のプログラミング初心者が厂辫谤颈苍驳を学ぶための手引き入社1年目のプログラミング初心者が厂辫谤颈苍驳を学ぶための手引き
入社1年目のプログラミング初心者が厂辫谤颈苍驳を学ぶための手引き
土岐 孝平
?
Introduction to RxJS
Introduction to RxJSIntroduction to RxJS
Introduction to RxJS
Brainhub
?
Micrometerでメトリクスを収集してAmazon CloudWatchで可視化
Micrometerでメトリクスを収集してAmazon CloudWatchで可視化Micrometerでメトリクスを収集してAmazon CloudWatchで可視化
Micrometerでメトリクスを収集してAmazon CloudWatchで可視化
Ryosuke Uchitate
?
厂辫谤颈苍驳を使った飞别产アプリにリファクタリングしよう
厂辫谤颈苍驳を使った飞别产アプリにリファクタリングしよう厂辫谤颈苍驳を使った飞别产アプリにリファクタリングしよう
厂辫谤颈苍驳を使った飞别产アプリにリファクタリングしよう
土岐 孝平
?
How WebAssembly is changing the Web and what it means for Angular
How WebAssembly is changing the Web and what it means for AngularHow WebAssembly is changing the Web and what it means for Angular
How WebAssembly is changing the Web and what it means for Angular
Boyan Mihaylov
?
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...
What is Node.js | Node.js Tutorial for Beginners | Node.js Modules | Node.js ...
Edureka!
?
gRPC on .NET Core - NDC Sydney 2019
gRPC on .NET Core - NDC Sydney 2019gRPC on .NET Core - NDC Sydney 2019
gRPC on .NET Core - NDC Sydney 2019
James Newton-King
?
"How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie...
"How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie..."How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie...
"How to Use Bazel to Manage Monorepos: The Grammarly Front-End Team’s Experie...
Fwdays
?
闯别苍办颈苍蝉使ってみた~奥颈苍诲辞飞蝉编~
闯别苍办颈苍蝉使ってみた~奥颈苍诲辞飞蝉编~闯别苍办颈苍蝉使ってみた~奥颈苍诲辞飞蝉编~
闯别苍办颈苍蝉使ってみた~奥颈苍诲辞飞蝉编~
Yuta Matsumura
?
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.js
Dinesh U
?

Similar to Micro-frontends with Angular 10 (Modern Web 2020) (20)

Angular 7 全新功能探索 (Angular Taiwan 2018)
Angular 7 全新功能探索 (Angular Taiwan 2018)Angular 7 全新功能探索 (Angular Taiwan 2018)
Angular 7 全新功能探索 (Angular Taiwan 2018)
Will Huang
?
Angular 4 網站開發最佳實務 (Modern Web 2017)
Angular 4 網站開發最佳實務 (Modern Web 2017)Angular 4 網站開發最佳實務 (Modern Web 2017)
Angular 4 網站開發最佳實務 (Modern Web 2017)
Will Huang
?
Koubei banquet 27
Koubei banquet 27Koubei banquet 27
Koubei banquet 27
Koubei UED
?
快快樂樂學會 Angular 2 網站開發框架 (Modern Web 2016)
快快樂樂學會 Angular 2 網站開發框架 (Modern Web 2016)快快樂樂學會 Angular 2 網站開發框架 (Modern Web 2016)
快快樂樂學會 Angular 2 網站開發框架 (Modern Web 2016)
Will Huang
?
使用 TypeScript 駕馭 Web 世界的脫韁野馬:以 Angular 2 開發框架為例
使用 TypeScript 駕馭 Web 世界的脫韁野馬:以 Angular 2 開發框架為例使用 TypeScript 駕馭 Web 世界的脫韁野馬:以 Angular 2 開發框架為例
使用 TypeScript 駕馭 Web 世界的脫韁野馬:以 Angular 2 開發框架為例
Will Huang
?
Angular 5 全新功能探索 @ JSDC2017
Angular 5 全新功能探索 @ JSDC2017Angular 5 全新功能探索 @ JSDC2017
Angular 5 全新功能探索 @ JSDC2017
Will Huang
?
Better use angular
Better use angularBetter use angular
Better use angular
Yanru Li
?
20141212 html5 及微軟跨平台佈局 long
20141212 html5 及微軟跨平台佈局   long20141212 html5 及微軟跨平台佈局   long
20141212 html5 及微軟跨平台佈局 long
Meng-Ru (Raymond) Tsai
?
移动奥别产开发框架箩辩尘探讨
移动奥别产开发框架箩辩尘探讨移动奥别产开发框架箩辩尘探讨
移动奥别产开发框架箩辩尘探讨
newker
?
使用闯补惫补蝉肠谤颈辫迟及贬罢惭尝5打造协同运作系统
使用闯补惫补蝉肠谤颈辫迟及贬罢惭尝5打造协同运作系统使用闯补惫补蝉肠谤颈辫迟及贬罢惭尝5打造协同运作系统
使用闯补惫补蝉肠谤颈辫迟及贬罢惭尝5打造协同运作系统
Hsu Ping Feng
?
Insider Dev Tour - Taipei Productive and Fun Web Development with NodeJS and ...
Insider Dev Tour - Taipei Productive and Fun Web Development with NodeJS and ...Insider Dev Tour - Taipei Productive and Fun Web Development with NodeJS and ...
Insider Dev Tour - Taipei Productive and Fun Web Development with NodeJS and ...
jasonzheng50
?
WoT Frotend 的設計與實作
WoT Frotend 的設計與實作WoT Frotend 的設計與實作
WoT Frotend 的設計與實作
julie huang
?
2021laravelconftwslides8
2021laravelconftwslides82021laravelconftwslides8
2021laravelconftwslides8
LiviaLiaoFontech
?
Phalcon2014 Startup
Phalcon2014 StartupPhalcon2014 Startup
Phalcon2014 Startup
Steve Luo
?
Angular 4 新手入門攻略完全制霸
Angular 4 新手入門攻略完全制霸Angular 4 新手入門攻略完全制霸
Angular 4 新手入門攻略完全制霸
Will Huang
?
Clojure cnclojure-meetup
Clojure cnclojure-meetupClojure cnclojure-meetup
Clojure cnclojure-meetup
sunng87
?
ASP.NET MVC 6 新功能探索
ASP.NET MVC 6 新功能探索ASP.NET MVC 6 新功能探索
ASP.NET MVC 6 新功能探索
Will Huang
?
twMVC#17 | 使用Angular.js開發大型系統架構
twMVC#17 | 使用Angular.js開發大型系統架構twMVC#17 | 使用Angular.js開發大型系統架構
twMVC#17 | 使用Angular.js開發大型系統架構
twMVC
?
极速 Angular 开发:效能调校技巧 (ngChina 2019)
极速 Angular 开发:效能调校技巧 (ngChina 2019)极速 Angular 开发:效能调校技巧 (ngChina 2019)
极速 Angular 开发:效能调校技巧 (ngChina 2019)
Will Huang
?
企業導入 Angular 作為前端開發的好處
企業導入 Angular 作為前端開發的好處企業導入 Angular 作為前端開發的好處
企業導入 Angular 作為前端開發的好處
Oomusou Xiao
?
Angular 7 全新功能探索 (Angular Taiwan 2018)
Angular 7 全新功能探索 (Angular Taiwan 2018)Angular 7 全新功能探索 (Angular Taiwan 2018)
Angular 7 全新功能探索 (Angular Taiwan 2018)
Will Huang
?
Angular 4 網站開發最佳實務 (Modern Web 2017)
Angular 4 網站開發最佳實務 (Modern Web 2017)Angular 4 網站開發最佳實務 (Modern Web 2017)
Angular 4 網站開發最佳實務 (Modern Web 2017)
Will Huang
?
Koubei banquet 27
Koubei banquet 27Koubei banquet 27
Koubei banquet 27
Koubei UED
?
快快樂樂學會 Angular 2 網站開發框架 (Modern Web 2016)
快快樂樂學會 Angular 2 網站開發框架 (Modern Web 2016)快快樂樂學會 Angular 2 網站開發框架 (Modern Web 2016)
快快樂樂學會 Angular 2 網站開發框架 (Modern Web 2016)
Will Huang
?
使用 TypeScript 駕馭 Web 世界的脫韁野馬:以 Angular 2 開發框架為例
使用 TypeScript 駕馭 Web 世界的脫韁野馬:以 Angular 2 開發框架為例使用 TypeScript 駕馭 Web 世界的脫韁野馬:以 Angular 2 開發框架為例
使用 TypeScript 駕馭 Web 世界的脫韁野馬:以 Angular 2 開發框架為例
Will Huang
?
Angular 5 全新功能探索 @ JSDC2017
Angular 5 全新功能探索 @ JSDC2017Angular 5 全新功能探索 @ JSDC2017
Angular 5 全新功能探索 @ JSDC2017
Will Huang
?
Better use angular
Better use angularBetter use angular
Better use angular
Yanru Li
?
20141212 html5 及微軟跨平台佈局 long
20141212 html5 及微軟跨平台佈局   long20141212 html5 及微軟跨平台佈局   long
20141212 html5 及微軟跨平台佈局 long
Meng-Ru (Raymond) Tsai
?
移动奥别产开发框架箩辩尘探讨
移动奥别产开发框架箩辩尘探讨移动奥别产开发框架箩辩尘探讨
移动奥别产开发框架箩辩尘探讨
newker
?
使用闯补惫补蝉肠谤颈辫迟及贬罢惭尝5打造协同运作系统
使用闯补惫补蝉肠谤颈辫迟及贬罢惭尝5打造协同运作系统使用闯补惫补蝉肠谤颈辫迟及贬罢惭尝5打造协同运作系统
使用闯补惫补蝉肠谤颈辫迟及贬罢惭尝5打造协同运作系统
Hsu Ping Feng
?
Insider Dev Tour - Taipei Productive and Fun Web Development with NodeJS and ...
Insider Dev Tour - Taipei Productive and Fun Web Development with NodeJS and ...Insider Dev Tour - Taipei Productive and Fun Web Development with NodeJS and ...
Insider Dev Tour - Taipei Productive and Fun Web Development with NodeJS and ...
jasonzheng50
?
WoT Frotend 的設計與實作
WoT Frotend 的設計與實作WoT Frotend 的設計與實作
WoT Frotend 的設計與實作
julie huang
?
Phalcon2014 Startup
Phalcon2014 StartupPhalcon2014 Startup
Phalcon2014 Startup
Steve Luo
?
Angular 4 新手入門攻略完全制霸
Angular 4 新手入門攻略完全制霸Angular 4 新手入門攻略完全制霸
Angular 4 新手入門攻略完全制霸
Will Huang
?
Clojure cnclojure-meetup
Clojure cnclojure-meetupClojure cnclojure-meetup
Clojure cnclojure-meetup
sunng87
?
ASP.NET MVC 6 新功能探索
ASP.NET MVC 6 新功能探索ASP.NET MVC 6 新功能探索
ASP.NET MVC 6 新功能探索
Will Huang
?
twMVC#17 | 使用Angular.js開發大型系統架構
twMVC#17 | 使用Angular.js開發大型系統架構twMVC#17 | 使用Angular.js開發大型系統架構
twMVC#17 | 使用Angular.js開發大型系統架構
twMVC
?
极速 Angular 开发:效能调校技巧 (ngChina 2019)
极速 Angular 开发:效能调校技巧 (ngChina 2019)极速 Angular 开发:效能调校技巧 (ngChina 2019)
极速 Angular 开发:效能调校技巧 (ngChina 2019)
Will Huang
?
企業導入 Angular 作為前端開發的好處
企業導入 Angular 作為前端開發的好處企業導入 Angular 作為前端開發的好處
企業導入 Angular 作為前端開發的好處
Oomusou Xiao
?

More from Will Huang (20)

深入理解 CVE-2022-24765 漏洞的攻擊與防護策略 (Git v2.35.2)
深入理解 CVE-2022-24765 漏洞的攻擊與防護策略 (Git v2.35.2)深入理解 CVE-2022-24765 漏洞的攻擊與防護策略 (Git v2.35.2)
深入理解 CVE-2022-24765 漏洞的攻擊與防護策略 (Git v2.35.2)
Will Huang
?
從頭打造 C#、.NET 與 ASP.NET Core 開發環境
從頭打造 C#、.NET 與 ASP.NET Core 開發環境從頭打造 C#、.NET 與 ASP.NET Core 開發環境
從頭打造 C#、.NET 與 ASP.NET Core 開發環境
Will Huang
?
ASP.NET Core 6.0 全新功能探索
ASP.NET Core 6.0 全新功能探索ASP.NET Core 6.0 全新功能探索
ASP.NET Core 6.0 全新功能探索
Will Huang
?
你一定不能不知道的 Markdown 寫作技巧
你一定不能不知道的 Markdown 寫作技巧你一定不能不知道的 Markdown 寫作技巧
你一定不能不知道的 Markdown 寫作技巧
Will Huang
?
使用 .NET 5 實現美股期貨的量化交易策略 (.NET Conf 2020)
使用 .NET 5 實現美股期貨的量化交易策略 (.NET Conf 2020)使用 .NET 5 實現美股期貨的量化交易策略 (.NET Conf 2020)
使用 .NET 5 實現美股期貨的量化交易策略 (.NET Conf 2020)
Will Huang
?
實現 Angular, Docker 與 Kubernetes 持續部署 (NG+2020)
實現 Angular, Docker 與 Kubernetes 持續部署 (NG+2020)實現 Angular, Docker 與 Kubernetes 持續部署 (NG+2020)
實現 Angular, Docker 與 Kubernetes 持續部署 (NG+2020)
Will Huang
?
從實戰經驗看到的 K8S 導入痛點
從實戰經驗看到的 K8S 導入痛點從實戰經驗看到的 K8S 導入痛點
從實戰經驗看到的 K8S 導入痛點
Will Huang
?
你不可不知的 ASP.NET Core 3 全新功能探索 (.NET Conf 2019)
你不可不知的 ASP.NET Core 3 全新功能探索 (.NET Conf 2019)你不可不知的 ASP.NET Core 3 全新功能探索 (.NET Conf 2019)
你不可不知的 ASP.NET Core 3 全新功能探索 (.NET Conf 2019)
Will Huang
?
Protractor: The Hacker way (NG-MY 2019)
Protractor: The Hacker way (NG-MY 2019)Protractor: The Hacker way (NG-MY 2019)
Protractor: The Hacker way (NG-MY 2019)
Will Huang
?
邁向 Windows Server 應用程式現代化 (Windows Server Application Modernization)
邁向 Windows Server 應用程式現代化 (Windows Server Application Modernization)邁向 Windows Server 應用程式現代化 (Windows Server Application Modernization)
邁向 Windows Server 應用程式現代化 (Windows Server Application Modernization)
Will Huang
?
Angular 开发技巧 (2018 ngChina 开发者大会)
Angular 开发技巧 (2018 ngChina 开发者大会)Angular 开发技巧 (2018 ngChina 开发者大会)
Angular 开发技巧 (2018 ngChina 开发者大会)
Will Huang
?
利用.NET Core 與 Azure Kubernetes Service (AKS) 建立高彈性 Microservices (Azure TechDay)
利用.NET Core 與 Azure Kubernetes Service (AKS) 建立高彈性 Microservices (Azure TechDay)利用.NET Core 與 Azure Kubernetes Service (AKS) 建立高彈性 Microservices (Azure TechDay)
利用.NET Core 與 Azure Kubernetes Service (AKS) 建立高彈性 Microservices (Azure TechDay)
Will Huang
?
AKS 與開發人員體驗 (Kubernetes 大講堂)
AKS 與開發人員體驗 (Kubernetes 大講堂)AKS 與開發人員體驗 (Kubernetes 大講堂)
AKS 與開發人員體驗 (Kubernetes 大講堂)
Will Huang
?
使用 ASP.NET Blazor 開發 SPA 網頁應用程式 (.NET Conf 2018)
使用 ASP.NET Blazor 開發 SPA 網頁應用程式 (.NET Conf 2018)使用 ASP.NET Blazor 開發 SPA 網頁應用程式 (.NET Conf 2018)
使用 ASP.NET Blazor 開發 SPA 網頁應用程式 (.NET Conf 2018)
Will Huang
?
全新 Windows Server 2019 容器技術 及邁向與 Kubernetes 整合之路 (Windows Server 高峰會)
全新 Windows Server 2019 容器技術及邁向與 Kubernetes 整合之路 (Windows Server 高峰會)全新 Windows Server 2019 容器技術及邁向與 Kubernetes 整合之路 (Windows Server 高峰會)
全新 Windows Server 2019 容器技術 及邁向與 Kubernetes 整合之路 (Windows Server 高峰會)
Will Huang
?
使用 C#/Razor 開發互動式 WebAssembly 網站 (Modern Web 2018)
使用 C#/Razor 開發互動式 WebAssembly 網站 (Modern Web 2018)使用 C#/Razor 開發互動式 WebAssembly 網站 (Modern Web 2018)
使用 C#/Razor 開發互動式 WebAssembly 網站 (Modern Web 2018)
Will Huang
?
以敏捷架构打造美国软体外包专案的经验谈
以敏捷架构打造美国软体外包专案的经验谈以敏捷架构打造美国软体外包专案的经验谈
以敏捷架构打造美国软体外包专案的经验谈
Will Huang
?
開發人員必須知道的 Kubernetes 核心技術 - Kubernetes Summit 2018
開發人員必須知道的 Kubernetes 核心技術 - Kubernetes Summit 2018開發人員必須知道的 Kubernetes 核心技術 - Kubernetes Summit 2018
開發人員必須知道的 Kubernetes 核心技術 - Kubernetes Summit 2018
Will Huang
?
迎接崭新的奥颈苍诲辞飞蝉容器丛集架构:碍耻产别谤苍别迟别蝉
迎接崭新的奥颈苍诲辞飞蝉容器丛集架构:碍耻产别谤苍别迟别蝉迎接崭新的奥颈苍诲辞飞蝉容器丛集架构:碍耻产别谤苍别迟别蝉
迎接崭新的奥颈苍诲辞飞蝉容器丛集架构:碍耻产别谤苍别迟别蝉
Will Huang
?
TypeScript 綜合格鬥技
TypeScript 綜合格鬥技TypeScript 綜合格鬥技
TypeScript 綜合格鬥技
Will Huang
?
深入理解 CVE-2022-24765 漏洞的攻擊與防護策略 (Git v2.35.2)
深入理解 CVE-2022-24765 漏洞的攻擊與防護策略 (Git v2.35.2)深入理解 CVE-2022-24765 漏洞的攻擊與防護策略 (Git v2.35.2)
深入理解 CVE-2022-24765 漏洞的攻擊與防護策略 (Git v2.35.2)
Will Huang
?
從頭打造 C#、.NET 與 ASP.NET Core 開發環境
從頭打造 C#、.NET 與 ASP.NET Core 開發環境從頭打造 C#、.NET 與 ASP.NET Core 開發環境
從頭打造 C#、.NET 與 ASP.NET Core 開發環境
Will Huang
?
ASP.NET Core 6.0 全新功能探索
ASP.NET Core 6.0 全新功能探索ASP.NET Core 6.0 全新功能探索
ASP.NET Core 6.0 全新功能探索
Will Huang
?
你一定不能不知道的 Markdown 寫作技巧
你一定不能不知道的 Markdown 寫作技巧你一定不能不知道的 Markdown 寫作技巧
你一定不能不知道的 Markdown 寫作技巧
Will Huang
?
使用 .NET 5 實現美股期貨的量化交易策略 (.NET Conf 2020)
使用 .NET 5 實現美股期貨的量化交易策略 (.NET Conf 2020)使用 .NET 5 實現美股期貨的量化交易策略 (.NET Conf 2020)
使用 .NET 5 實現美股期貨的量化交易策略 (.NET Conf 2020)
Will Huang
?
實現 Angular, Docker 與 Kubernetes 持續部署 (NG+2020)
實現 Angular, Docker 與 Kubernetes 持續部署 (NG+2020)實現 Angular, Docker 與 Kubernetes 持續部署 (NG+2020)
實現 Angular, Docker 與 Kubernetes 持續部署 (NG+2020)
Will Huang
?
從實戰經驗看到的 K8S 導入痛點
從實戰經驗看到的 K8S 導入痛點從實戰經驗看到的 K8S 導入痛點
從實戰經驗看到的 K8S 導入痛點
Will Huang
?
你不可不知的 ASP.NET Core 3 全新功能探索 (.NET Conf 2019)
你不可不知的 ASP.NET Core 3 全新功能探索 (.NET Conf 2019)你不可不知的 ASP.NET Core 3 全新功能探索 (.NET Conf 2019)
你不可不知的 ASP.NET Core 3 全新功能探索 (.NET Conf 2019)
Will Huang
?
Protractor: The Hacker way (NG-MY 2019)
Protractor: The Hacker way (NG-MY 2019)Protractor: The Hacker way (NG-MY 2019)
Protractor: The Hacker way (NG-MY 2019)
Will Huang
?
邁向 Windows Server 應用程式現代化 (Windows Server Application Modernization)
邁向 Windows Server 應用程式現代化 (Windows Server Application Modernization)邁向 Windows Server 應用程式現代化 (Windows Server Application Modernization)
邁向 Windows Server 應用程式現代化 (Windows Server Application Modernization)
Will Huang
?
Angular 开发技巧 (2018 ngChina 开发者大会)
Angular 开发技巧 (2018 ngChina 开发者大会)Angular 开发技巧 (2018 ngChina 开发者大会)
Angular 开发技巧 (2018 ngChina 开发者大会)
Will Huang
?
利用.NET Core 與 Azure Kubernetes Service (AKS) 建立高彈性 Microservices (Azure TechDay)
利用.NET Core 與 Azure Kubernetes Service (AKS) 建立高彈性 Microservices (Azure TechDay)利用.NET Core 與 Azure Kubernetes Service (AKS) 建立高彈性 Microservices (Azure TechDay)
利用.NET Core 與 Azure Kubernetes Service (AKS) 建立高彈性 Microservices (Azure TechDay)
Will Huang
?
AKS 與開發人員體驗 (Kubernetes 大講堂)
AKS 與開發人員體驗 (Kubernetes 大講堂)AKS 與開發人員體驗 (Kubernetes 大講堂)
AKS 與開發人員體驗 (Kubernetes 大講堂)
Will Huang
?
使用 ASP.NET Blazor 開發 SPA 網頁應用程式 (.NET Conf 2018)
使用 ASP.NET Blazor 開發 SPA 網頁應用程式 (.NET Conf 2018)使用 ASP.NET Blazor 開發 SPA 網頁應用程式 (.NET Conf 2018)
使用 ASP.NET Blazor 開發 SPA 網頁應用程式 (.NET Conf 2018)
Will Huang
?
全新 Windows Server 2019 容器技術 及邁向與 Kubernetes 整合之路 (Windows Server 高峰會)
全新 Windows Server 2019 容器技術及邁向與 Kubernetes 整合之路 (Windows Server 高峰會)全新 Windows Server 2019 容器技術及邁向與 Kubernetes 整合之路 (Windows Server 高峰會)
全新 Windows Server 2019 容器技術 及邁向與 Kubernetes 整合之路 (Windows Server 高峰會)
Will Huang
?
使用 C#/Razor 開發互動式 WebAssembly 網站 (Modern Web 2018)
使用 C#/Razor 開發互動式 WebAssembly 網站 (Modern Web 2018)使用 C#/Razor 開發互動式 WebAssembly 網站 (Modern Web 2018)
使用 C#/Razor 開發互動式 WebAssembly 網站 (Modern Web 2018)
Will Huang
?
以敏捷架构打造美国软体外包专案的经验谈
以敏捷架构打造美国软体外包专案的经验谈以敏捷架构打造美国软体外包专案的经验谈
以敏捷架构打造美国软体外包专案的经验谈
Will Huang
?
開發人員必須知道的 Kubernetes 核心技術 - Kubernetes Summit 2018
開發人員必須知道的 Kubernetes 核心技術 - Kubernetes Summit 2018開發人員必須知道的 Kubernetes 核心技術 - Kubernetes Summit 2018
開發人員必須知道的 Kubernetes 核心技術 - Kubernetes Summit 2018
Will Huang
?
迎接崭新的奥颈苍诲辞飞蝉容器丛集架构:碍耻产别谤苍别迟别蝉
迎接崭新的奥颈苍诲辞飞蝉容器丛集架构:碍耻产别谤苍别迟别蝉迎接崭新的奥颈苍诲辞飞蝉容器丛集架构:碍耻产别谤苍别迟别蝉
迎接崭新的奥颈苍诲辞飞蝉容器丛集架构:碍耻产别谤苍别迟别蝉
Will Huang
?
TypeScript 綜合格鬥技
TypeScript 綜合格鬥技TypeScript 綜合格鬥技
TypeScript 綜合格鬥技
Will Huang
?

Micro-frontends with Angular 10 (Modern Web 2020)

  • 3. Micro-frontends with Angular 10 使用 Angular 10 實現微前端 Implementing Micro-frontends with Angular 10 將元件整合進不同的前端框架 Integrate Angular 10 components into other frameworks 何謂微前端 What is Micro-frontends?
  • 4. Micro-frontends with Angular 10 使用 Angular 10 實現微前端 Implementing Micro-frontends with Angular 10 將元件整合進不同的前端框架Integrate Angular 10 components into other frameworks 何謂微前端 What is Micro-frontends?
  • 5. 微前端 (Micro Frontends) ? 最早出現於 2016 年 ThoughtWorks 的技術雷達 ? 借用 微服務架構 (Microservices) 許多概念與作法 ? 有效解構大型前端架構下的各種相依、協作、整合等問題 ? Be Technology Agnostic(不限定各團隊所採用的前端技術) ? Isolate Team Code(不同的團隊代碼必須彼此隔離以降低相依性) ? Establish Team Prefixes(建立團隊之間的命名規則以降低資源衝突) ? Favor Native Browser Features over Custom APIs(使用原生 API 為 主) ? Build a Resilient Site(建置有高度彈性、遇到錯誤可迅速回復的站台)
  • 7. 套用微前端架構的 HTML 結構範例 可動態載入外部 JS 檔案 自訂元素 (Custom Elements) Custom Elements (V1)
  • 8. Micro-frontends with Angular 10 使用 Angular 10 實現微前端 Implementing Micro-frontends with Angular 10 將元件整合進不同的前端框架Integrate Angular 10 components into other frameworks 何謂微前端 What is Micro-frontends?
  • 9. 初始化專案 ? ng new --create-application=false mfdemo1 && cd mfdemo1 ? ng g application mfdemo1 --routing --style=css ? ng g application mf-element1 --routing=false --style=css ? ng add @angular/elements --project=mf-element1 ? ng add ngx-build-plus --project=mf-element1
  • 10. 移除 AppComponent 的 selector 屬性 import { Component } from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { title = 'mf-element1'; }
  • 11. 移除 AppModule 的 bootstrap 屬性 @NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule ], providers: [] , bootstrap: [AppComponent] }) export class AppModule { … }
  • 12. 加入 AppModule 的 ngDoBootstrap() import { Injector } from '@angular/core'; import { createCustomElement } from '@angular/elements'; @NgModule(…) export class AppModule { constructor(private injector: Injector) {} ngDoBootstrap(): void { const customElement = createCustomElement(AppComponent, { injector: this.injector }); customElements.define('mf-element1', customElement); } }
  • 13. 關於 Polyfills 設定 ? 使用於 non-Angular 網頁環境需額外載入 zone.js 才能執行 ? node_modules/zone.js/dist/zone.min.js ? 針對不支援 Custom Elements (V1) 的瀏覽器提供 Polyfills (IE11) ? 在執行 ng add @angular/elements 的時候會自動加入 document-register-element 套件 ? node_modules/document-register-element/build/document-register-element.js ? 其他可能需要的 Polyfills 套件 ? ng g ngx-build-plus:wc-polyfill --project mf-element1 ? npm install core-js@2
  • 14. 建置專案 ? ng build --project=mfdemo1 --prod --output-hashing=none ? ng build --project=mf-element1 --prod --output-hashing=none --single-bundle mfdemo1 mf-element1 說明 3rdpartylicenses.txt 3rdpartylicenses.txt 所有套件的授權聲明 favicon1.ico favicon1.ico 網站的 Favicon 圖檔 index.html index.html 網站預設首頁 main.js main.js 主要程式 runtime.js 內容被合併至 main.js 執行 Angular 所需的共用程式 polyfills.js polyfills.js 支援舊版瀏覽器所需的 Polyfills styles.css styles.css 全站共用的 CSS 內容
  • 15. 部署 Angular Elements 與 Polyfills ? 複製主程式與 Polyfills ? cp dist/mf-element1/main.js dist/mfdemo1/mf-element1.js ? cp dist/mf-element1/polyfills.js dist/mfdemo1/mf-polyfills.js ? 僅複製必要的 zone.js 與 document-register-element.js ? cp node_modules/zone.js/dist/zone.min.js dist/mf-element1/zone.min.js ? cp node_modules/document-register-element/build/document-register-element.js dist/mf- element1/document-register-element.js ? 注意事項:請不要在 main.ts 匯入 zone.js ? import 'zone.js/dist/zone'; ? Configuring CommonJS dependencies
  • 16. Micro-frontends with Angular 10 使用 Angular 10 實現微前端 Implementing Micro-frontends with Angular 10 將元件整合進不同的前端框架Integrate Angular 10 components into other frameworks 何謂微前端 What is Micro-frontends?
  • 17. 非 Angular 網頁嵌入 Angular Elements <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Mfdemo1</title> </head> <body> <mf-element1></mf-element1> <script src=/slideshow/microfrontends-with-angular-10/239038336/"mf-polyfills.js" defer></script> <script src="mf-element1.js" defer></script> </body> </html>
  • 18. 非 Angular 網頁嵌入 Angular Elements <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Mfdemo1</title> </head> <body> <mf-element1></mf-element1> <script src=/slideshow/microfrontends-with-angular-10/239038336/"zone.min.js" defer></script> <script src="mf-element1.js" defer></script> </body> </html>
  • 19. 從 Angular 載入 Angular Elements ? 安裝 Angular Extensions Elements 套件 ? npm i @angular-extensions/elements ? 匯入 LazyElementsModule 至 AppModule 的 imports 屬性 ? import { LazyElementsModule } from '@angular-extensions/elements'; ? 加入 CUSTOM_ELEMENTS_SCHEMA 至 AppModule 的 schemas 屬性 ? schemas: [CUSTOM_ELEMENTS_SCHEMA] ? 使用 *axLazyElement 結構型指令 ? <mf-element1 *axLazyElement="'/mf-element1.js'"></mf-element1> ? The Best Way To Lazy Load Angular Elements | by Tomas Trajan ? Angular Elements Demo

Editor's Notes

  • #10: npm i @webcomponents/custom-elements npm i core-js@2
  • #16: https://github.com/manfredsteyer/ngx-build-plus/issues/4