Skip to content

Commit eabf84e

Browse files
fix(admin): dev server で /admin (スラッシュ無し) も SPA にフォールバック
本番の GitHub Pages はディレクトリへの末尾スラッシュリダイレクトを行うが、 webpack-dev-server は行わないため /admin が Cannot GET になっていた。 historyApiFallback の index を publicPath 配下 (/admin/) に向ける。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 684d9b4 commit eabf84e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

packages/admin/webpack.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ module.exports = {
4848
],
4949
devServer: {
5050
port: process.env.PORT || 8602,
51-
historyApiFallback: true
51+
// Rewrite unknown paths (including the slashless /admin) to the SPA
52+
// index, which lives under publicPath — GitHub Pages does the
53+
// trailing-slash redirect in production, the dev server does not.
54+
historyApiFallback: {index: '/admin/'}
5255
},
5356
devtool: process.env.NODE_ENV === 'production' ? false : 'cheap-module-source-map'
5457
};

0 commit comments

Comments
 (0)