メインコンテンツまでスキップ
バージョン: v5 (Preview)

Webapp Output Target: www

The www output target type is oriented for webapps and websites, hosted from an http server, which can benefit from prerendering and service workers, such as this very site you're reading. For a walkthrough, see Using Stencil for an Application.

Even if a project is meant to only build a reusable component library, the www output target is useful to build out and test the components throughout development.

outputTargets: [
{
type: 'www'
}
]

構成​

プロパティ説明デフォルト値
baseUrlbaseUrlは、提供されるサイトの「ベース」URLを表します。たとえば、このサイトのベースURLは https://stenciljs.com/です。ただし、サイト全体の出力がサブディレクトリ内にある場合、このディレクトリのパスは baseUrlである必要があります。たとえば、Ionicのドキュメントは、 https://ionicframework.com/内の /docsディレクトリにあるスタンドアロンのステンシルサイトです。この例では、 https://ionicframework.com/docs/がベースURLになります。/
buildDirThe buildDir is the directory of Stencil's generated scripts, such as the component files.build
bundleModeChooses how components are bundled for this output. 'loader' uses the loader-bundle architecture: chunk-split, loaded lazily via a loader script. 'standalone' uses one module per component with an auto-loader instead - simpler, easier to debug. Defaults to 'standalone' only if a standalone output target is configured and no loader-bundle is; otherwise defaults to 'loader'.'loader' (auto-detected)
copyAn array of copy tasks to run during the build, in addition to the assets/manifest.json files Stencil already copies automatically.undefined
dirdir設定は、パブリックWeb配布ディレクトリを指定します。このディレクトリは通常、静的ファイルの提供など、提供されるアプリのルートディレクトリです。このディレクトリは、ソースファイルから直接ビルドおよび再ビルドされます。さらに、これはビルドターゲットであるため、ビルドのたびにすべてのファイルが削除および再ビルドされるため、常にソースファイルをこのディレクトリにコピーすることをお勧めします。このディレクトリはリポジトリにコミットしないことをお勧めします。www
emptyデフォルトでは、各ビルドの前に、 dirディレクトリからすべてのファイルが空になります。ただし、このディレクトリが空にならないようにするには、この値を「false」に変更します。true
hashedFileNameLengthNumber of characters to use for the content hash in filenames, when hashFileNames is enabled.8
hashFileNamesHash the filenames of generated chunks based on their content, enabling forever-caching of CDN-served bundles.true in production, false in dev
indexHtmlindexHtmlプロパティは、ルートインデックスhtmlファイルの場所を表します。index.html
prerenderConfigPath to a module exporting prerender hooks (beforeSsr, afterSsr) run against each prerendered page. See Prerender Config.undefined
serviceWorkerService worker config for production builds - null by default, so nothing is generated unless you opt in. Set to true to generate one with default settings, or provide a config object to customize it; any values you provide override Stencil's defaults, per the Workbox documentation. In development mode, a script that deregisters any existing service worker is always injected instead.null (disabled)
skipInDevNot read by the www output target - this output always runs, in dev and production alike, regardless of this setting.n/a