diff --git a/src/.vuepress/config.js b/src/.vuepress/config.js
index f24c5a38..f53adb89 100644
--- a/src/.vuepress/config.js
+++ b/src/.vuepress/config.js
@@ -211,16 +211,16 @@ const sidebar = {
]
},
],
- // ssr: [
- // ['/guide/ssr/introduction', 'Introduction'],
- // '/guide/ssr/getting-started',
- // '/guide/ssr/universal',
- // '/guide/ssr/structure',
- // '/guide/ssr/build-config',
- // '/guide/ssr/server',
- // '/guide/ssr/routing',
- // '/guide/ssr/hydration'
- // ],
+ ssr: [
+ ['/guide/ssr/introduction', 'Introduction'],
+ '/guide/ssr/getting-started',
+ '/guide/ssr/universal',
+ '/guide/ssr/structure',
+ '/guide/ssr/build-config',
+ '/guide/ssr/server',
+ '/guide/ssr/routing',
+ '/guide/ssr/hydration'
+ ],
contributing: [
{
title: 'ドキュメントへの貢献',
diff --git a/src/guide/ssr.md b/src/guide/ssr.md
index d8767cc3..da654069 100644
--- a/src/guide/ssr.md
+++ b/src/guide/ssr.md
@@ -2,7 +2,7 @@
## 完全な SSR ガイド
-私たちは、サーバーでレンダリングされた Vue アプリケーションを作成するためのスタンドアロンのガイドを作成しました。これは、すでにクライアント側の Vue 開発、サーバー側の Node.js 開発そして Webpack に精通している方にとって非常に詳細なガイドです。[ssr.vuejs.org](https://ssr.vuejs.org/) を確認してください。
+私たちは、サーバーでレンダリングされた Vue アプリケーションを作成するためのスタンドアロンのガイドを作成しました。これは、すでにクライアント側の Vue 開発、サーバー側の Node.js 開発そして Webpack に精通している方にとって非常に詳細なガイドです。[こちら](/guide/ssr/introduction.html) を確認してください。
## Nuxt.js
@@ -11,3 +11,13 @@
## Quasar Framework SSR + PWA
[Quasar Framework](https://quasar.dev) は、SSR アプリケーション (PWA ハンドオフオプションあり) を生成するフレームワークで、最高クラスのビルドシステム、実用的な環境設定、そして開発者の拡張性を活用して、あなたのアイデアを設計し構築することを簡単にします。100 を超える "Material Design 2.0" に準拠したコンポーネントがあり、どれかひとつをサーバ上で実行できます。これはブラウザでも使用でき、サイト内の `` タグで管理もできます。 Quasar は Node.js と webpack ベースの開発環境で、SPA、PWA、SSR、Electron、Capacitor、そして Cordova アプリケーション、全て 1 つのコードベースからの迅速な開発を合理化し、加速させます。
+
+## Vite SSR
+
+[Vite](https://vitejs.dev/) は、フロントエンド開発の経験を大幅に改善する新しいタイプのフロントエンドビルドツールです。大きく分けて 2 つの部分で構成されています。:
+
+- ソースファイルをネイティブ ES モジュールで提供する開発サーバで、豊富な組み込み機能と、驚異的な速さの HMR (Hot Module Replacement) を備えています。
+
+- コードを [Rollup](https://rollupjs.org/) でバンドルするビルドコマンドで、本番用に高度に最適化した静的アセットを出力するようにあらかじめ設定されています。
+
+Vite は組み込みの [サーバサイドレンダリングのサポート](https://vitejs.dev/guide/ssr.html) もあります。Vue を使ったプロジェクトの例は [こちら](https://github.com/vitejs/vite/tree/main/packages/playground/ssr-vue) で見ることができます。
diff --git a/src/guide/ssr/build-config.md b/src/guide/ssr/build-config.md
new file mode 100644
index 00000000..34360942
--- /dev/null
+++ b/src/guide/ssr/build-config.md
@@ -0,0 +1,106 @@
+# Build Configuration
+
+The webpack config for an SSR project will be similar to a client-only project. If you're not familiar with configuring webpack, you can find more information in the documentation for [Vue CLI](https://cli.vuejs.org/guide/webpack.html#working-with-webpack) or [configuring Vue Loader manually](https://vue-loader.vuejs.org/guide/#manual-setup).
+
+## Key Differences with Client-Only Builds
+
+1. We need to create a [webpack manifest](https://webpack.js.org/concepts/manifest/) for our server-side code. This is a JSON file that webpack keeps to track how all the modules map to the output bundles.
+
+2. We should [externalize application dependencies](https://webpack.js.org/configuration/externals/). This makes the server build much faster and generates a smaller bundle file. When doing this, we have to exclude dependencies that need to be processed by webpack (like `.css`. or `.vue` files).
+
+3. We need to change webpack [target](https://webpack.js.org/concepts/targets/) to Node.js. This allows webpack to handle dynamic imports in a Node-appropriate fashion, and also tells `vue-loader` to emit server-oriented code when compiling Vue components.
+
+4. When building a server entry, we would need to define an environment variable to indicate we are working with SSR. It might be helpful to add a few `scripts` to the project's `package.json`:
+
+```json
+"scripts": {
+ "build:client": "vue-cli-service build --dest dist/client",
+ "build:server": "SSR=1 vue-cli-service build --dest dist/server",
+ "build": "npm run build:client && npm run build:server",
+}
+```
+
+## Example Configuration
+
+Below is a sample `vue.config.js` that adds SSR rendering to a Vue CLI project, but it can be adapted for any webpack build.
+
+```js
+const { WebpackManifestPlugin } = require('webpack-manifest-plugin')
+const nodeExternals = require('webpack-node-externals')
+const webpack = require('webpack')
+
+module.exports = {
+ chainWebpack: webpackConfig => {
+ // We need to disable cache loader, otherwise the client build
+ // will used cached components from the server build
+ webpackConfig.module.rule('vue').uses.delete('cache-loader')
+ webpackConfig.module.rule('js').uses.delete('cache-loader')
+ webpackConfig.module.rule('ts').uses.delete('cache-loader')
+ webpackConfig.module.rule('tsx').uses.delete('cache-loader')
+
+ if (!process.env.SSR) {
+ // Point entry to your app's client entry file
+ webpackConfig
+ .entry('app')
+ .clear()
+ .add('./src/entry-client.js')
+ return
+ }
+
+ // Point entry to your app's server entry file
+ webpackConfig
+ .entry('app')
+ .clear()
+ .add('./src/entry-server.js')
+
+ // This allows webpack to handle dynamic imports in a Node-appropriate
+ // fashion, and also tells `vue-loader` to emit server-oriented code when
+ // compiling Vue components.
+ webpackConfig.target('node')
+ // This tells the server bundle to use Node-style exports
+ webpackConfig.output.libraryTarget('commonjs2')
+
+ webpackConfig
+ .plugin('manifest')
+ .use(new WebpackManifestPlugin({ fileName: 'ssr-manifest.json' }))
+
+ // https://webpack.js.org/configuration/externals/#function
+ // https://github.com/liady/webpack-node-externals
+ // Externalize app dependencies. This makes the server build much faster
+ // and generates a smaller bundle file.
+
+ // Do not externalize dependencies that need to be processed by webpack.
+ // You should also whitelist deps that modify `global` (e.g. polyfills)
+ webpackConfig.externals(nodeExternals({ allowlist: /\.(css|vue)$/ }))
+
+ webpackConfig.optimization.splitChunks(false).minimize(false)
+
+ webpackConfig.plugins.delete('preload')
+ webpackConfig.plugins.delete('prefetch')
+ webpackConfig.plugins.delete('progress')
+ webpackConfig.plugins.delete('friendly-errors')
+
+ webpackConfig.plugin('limit').use(
+ new webpack.optimize.LimitChunkCountPlugin({
+ maxChunks: 1
+ })
+ )
+ }
+}
+```
+
+## Externals Caveats
+
+Notice that in the `externals` option we are whitelisting CSS files. This is because CSS imported from dependencies should still be handled by webpack. If you are importing any other types of files that also rely on webpack (e.g. `*.vue`, `*.sass`), you should add them to the whitelist as well.
+
+If you are using `runInNewContext: 'once'` or `runInNewContext: true`, then you also need to whitelist polyfills that modify `global`, e.g. `babel-polyfill`. This is because when using the new context mode, **code inside a server bundle has its own `global` object.** Since you don't really need it on the server, it's actually easier to just import it in the client entry.
+
+## Generating `clientManifest`
+
+In addition to the server bundle, we can also generate a client build manifest. With the client manifest and the server bundle, the renderer now has information of both the server _and_ client builds. This way it can automatically infer and inject [preload / prefetch directives](https://css-tricks.com/prefetching-preloading-prebrowsing/), `` and `