refactor: configure vite and next.js for correct module loading

This commit is contained in:
2025-06-04 11:11:45 +09:00
parent 4705247246
commit 34e9c33484
3 changed files with 3 additions and 2 deletions

View File

@ -8,6 +8,6 @@
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>
<script type="module" src="/src/main.tsx"></script> <script type="module" src="/src/main.tsx" defer></script>
</body> </body>
</html> </html>

View File

@ -2,6 +2,7 @@ import { defineConfig } from "vite";
import react from "@vitejs/plugin-react"; import react from "@vitejs/plugin-react";
export default defineConfig({ export default defineConfig({
root: '.', // プロジェクトルートを明示
plugins: [react()], plugins: [react()],
server: { server: {
port: 3000, port: 3000,
@ -12,5 +13,4 @@ export default defineConfig({
input: "index.html", input: "index.html",
}, },
}, },
root: process.cwd(), // 現在の作業ディレクトリfrontendをルートとして明示
}); });

View File

@ -2,6 +2,7 @@
const nextConfig = { const nextConfig = {
reactStrictMode: true, reactStrictMode: true,
output: 'standalone', output: 'standalone',
// Vite を使用している場合は Next.js の dev server は使わない
}; };
module.exports = nextConfig; module.exports = nextConfig;