静的サイトアダプター
Qwik の静的サイトアダプターは、任意のクラウドプロバイダーに簡単にデプロイできる静的 HTML ファイルを生成するのに役立ちます。
インストール
static-site
アダプターを統合するには、add
コマンドを使用します。
npm run qwik add static
上記のコマンドは、プロジェクトルートに adapters/static/vite.config.ts
という名前のディレクトリを作成し、以下のコードを配置します。
adapters/static/vite.config.ts
import { staticAdapter } from "@builder.io/qwik-city/adapters/static/vite";
import { extendConfig } from '@builder.io/qwik-city/vite';
import baseConfig from '../../vite.config';
export default extendConfig(baseConfig, () => {
return {
build: {
ssr: true,
rollupOptions: {
input: ['@qwik-city-plan'],
},
},
plugins: [
staticAdapter({
origin: 'https://yoursite.qwik.dev',
}),
],
};
});
このファイルの
origin
を自分のドメインに変更することを忘れないでください。
これで、Qwik の豊富なエコシステム、ファイルベースのルーティングなどを利用しながら、静的サイトを生成できます。