Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

development server take too long time #208

Open
monchansuzuki opened this issue Jul 27, 2024 · 0 comments
Open

development server take too long time #208

monchansuzuki opened this issue Jul 27, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@monchansuzuki
Copy link

What version of HonoX are you using?

0.1.23

What steps can reproduce the bug?

when I developing whit honox the first render take too long time. 15sec~30sec
i m using honox as ssr and for the client i m using react.
here is my vite/config.

import honox from 'honox/vite'
import client from 'honox/vite/client'
import { defineConfig } from 'vite'
import { builtinModules } from 'module'
import { type AliasOptions } from 'vite'
import path from 'node:path'
import commonjs from '@rollup/plugin-commonjs'
import Inspect from 'vite-plugin-inspect'

const entry = './index.ts'
const external: string | string[] = [
  '@prisma/client',
  'react',
  'react-dom',
  'antd',
  'axios',
  'react-hook-form',
  '@ant-design/icons',
  'tunnel',
  'form-data',
  'whatwg-url',
  'xml2js',
  '@azure/storage-blob',
  'dayjs',
  '@babel/runtime',
]

export const alias: AliasOptions = {
  '@': path.resolve(__dirname, './'),
}

export default defineConfig(({ mode }) => {
  if (mode === 'client') {
    return {
      resolve: { alias },
      plugins: [client({ jsxImportSource: 'react' }), commonjs({ transformMixedEsModules: true }), Inspect()],
    }
  } else {
    return {
      resolve: { alias },
      plugins: [honox({ entry }), Inspect()],

      ssr: {
        external,
      },
      build: {
        emptyOutDir: false,
        minify: true,
        ssr: true,
        rollupOptions: {
          external: [...builtinModules, /^node:/],
          input: entry,
          output: {
            entryFileNames: 'main.js',
          },
        },
        target: 'esnext',
      },
      server: {
        port: 4004,
      },
    }
  }
})

there s some metrics
Screenshot 2024-07-27 at 17 24 05
Screenshot 2024-07-27 at 17 23 48
Screenshot 2024-07-27 at 17 23 43

run:
npm vite

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

No response

@monchansuzuki monchansuzuki added the bug Something isn't working label Jul 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant