Stencil Config
Stencilでは、すぐに使えるデフォルトの値が設定されているため、多くの場合でstencil.config.tsファイルをカスタマイズする必要はありません。基本的に、設定をできるだけ最小限に抑えることをお勧めします。実際に、stencil.config.tsファイルを削除してもアプリは問題なくコンパイルされます。ですがそれと同時に、この設定を使用してコンパイラを最小限で構成できます。以降は、たくさんある任意の設定プロパティです。
stencil.config.tsの例:
import { Config } from '@stencil/core';
export const config: Config = {
namespace: 'MyApp',
srcDir: 'src'
};
buildDist
default: true (prod), false (dev)
Sets whether or not Stencil will execute output targets and write output to
dist/ when stencil build is called. Defaults to false when building for
development and true when building for production. If set to true then
Stencil will always build all output targets, regardless of whether the build
is in dev or prod mode or using watch mode.
buildDist: true
buildEs5
Sets if the ES5 build should be generated or not.
It defaults to false.
Setting buildEs5 to true will also create es5 builds for both dev and prod modes.
Setting buildEs5 to prod will only build ES5 in prod mode.
If the app does not need to run on legacy browsers (IE11 and Edge 18 and below), buildEs5 set to false, which will also speed up production build times.
In addition to creating es5 builds, apps may also be interested in enable runtime options to support legacy browsers.
See config extras for more information.
As of Stencil v3, legacy browser support is deprecated, and will be removed in a future major version of Stencil.
buildEs5: boolean | 'prod'
bundles
Stencilはデフォルト でアプリケーションを静的に分析し、すべてのコンポーネントがどのように相互接続されているかを示すコンポーネントグラフを生成します。コンポーネントグラフから、アプリ内での相互の使用状況に応じて、コンポーネントをどのようにグループ化するかを最適に判断できます。そうすることで、ネットワークへのリクエストを減らすためにコンポーネントをバンドルすることができます。バンドルはbundlesを使用して手動で生成することもできます。
bundlesは、コンポーネントが遅延ロードされたバンドルにグループ化される方法を表すオブジェクトの配列です。Stencilがバックグラウンドで自動的に処理するため、この構成はほとんど必要ありません。
bundles: [
{ components: ['ion-button'] },
{ components: ['ion-card', 'ion-card-header'] }
]
devServer
Dev-Server docsをご覧ください。
enableCache
デフォルト: true
Stencilは再ビルドを高速化するために、ビルド結果をキャッシュします。この機能を無効にするには、enableCacheをfalseに設定します。
enableCache: true