Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2022-02-14のJS: Parcel 2.3.0、Vite 2.8.0、Angular Compilerがどのように動いているか、JavaScriptでDDD #959

Merged
merged 26 commits into from Feb 14, 2022

Conversation

azu
Copy link
Member

@azu azu commented Feb 14, 2022

Parcel 2.3.0がリリースされました。

ParcelでParcel自体のいくつかの依存関係を事前にbundleするように変更。 Node Core ModulesのpolyfillやBabel/PostCSSの依存関係をオンデマンドでインストールするように変更などの変更が含まれています。

Vite 2.8.0がリリースされています。

macOS Montereyで5000 portが利用されているため、vite previewのデフォルトportが4173へと変更されています。

また、Workerとしてbundleする対象をURL使ったものへと変更して、これを推奨として扱うように変更されています。

- import MyWorker from './worker.js?worker'
- const worker = new MyWorker()
+ const worker = new Worker(new URL('./worker.js', import.meta.url), { type: 'module' }) 

Parcel 2.3.0の変更もそうですが、Vite 2.8.0でもパッケージのインストールサイズの削減が含まれています。
依存関係を含めたパッケージのインストールサイズの測定には、Package Phobiaというサイトが使われることが多いですが、それぞれのパッケージのサイズは次のページで見られます。

Parcelのインストールサイズが大きくなっているのは、実行する端末とは別のアーキテクチャのネイティブバイナリも含まれているためです。
Vite(esbuild)ではoptionalDependenciesを使って、実行する端末のアーキテクチャのバイナリだけをダウンロードしようとしています。

ただし、このoptionalDependenciesでアーキテクチャ別のパッケージ(バイナリ)を配布した時の挙動は、npm/yarn/pnpmで統一されているわけではありません。

現在SWCesbuildnapi-rsを使ったnative moduleの需要が高まってきたため、この挙動を定義する方法について議論がされています。


How the Angular Compiler Works. The Angular Compiler (which we call… | by Alex Rickabaugh | Feb, 2022 | Angular Blogという記事では、AngularのコンパイラーであるAngular Compilerがどのようにコンポーネントをコンパイルしてるかについて解説されています。

どのようにコンポーネントの型チェックをしているかや、Transpileしているかについて解説されています。


Implementing DDD, CQRS and Event Sourcingという書籍は、コードにJavaScript/Node.jsを使ってDDD(ドメイン駆動開発)について解説しています。

書籍では、DDDの概念とその実装について書かれていて、特定のフレームワークを使わずに理論と実装を進めながらアーキテクチャについて解説しています。

なぜ、DDDの解説にJavaScriptを使ったかやサードパーティのライブラリを使わずに解説したのかについてなどのFAQは次の記事で解説されています。

@azu azu merged commit 1072efb into develop Feb 14, 2022
@azu azu deleted the jser-week-579 branch February 14, 2022 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant