fix: 初始化
This commit is contained in:
20
packages/icpx-platform/plugins/vitePluginDotFallback.ts
Normal file
20
packages/icpx-platform/plugins/vitePluginDotFallback.ts
Normal file
@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Vite doesn't handle fallback html with dot (.), see https://github.com/vitejs/vite/issues/2415
|
||||
* TODO: Review the PR in Vite
|
||||
* @returns {import('vite').Plugin}
|
||||
*/
|
||||
export function spaFallbackWithDot() {
|
||||
return {
|
||||
name: 'spa-fallback-with-dot',
|
||||
configureServer(server) {
|
||||
return () => {
|
||||
server.middlewares.use(function customSpaFallback(req, res, next) {
|
||||
if (req.url.includes('.') && !req.url.endsWith('.html')) {
|
||||
req.url = '/index.html';
|
||||
}
|
||||
next();
|
||||
});
|
||||
};
|
||||
},
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user