logo
  • Guide
  • Config
  • Plugin
  • API
  • Examples
  • Community
  • Modern.js 2.x Docs
  • English
    • 简体中文
    • English
    • Commands
      File Conventions
      src/
      App.[tj]sx
      entry.[tj]s
      entry.server.[tj]sx
      modern.runtime.[tj]s
      routes/
      *.[server|node].[tj]sx
      api/
      lambda/*.[tj]s
      server/
      modern.server.[tj]s
      shared/
      config/
      html/
      favicon.*
      icon.*
      mock/
      public/
      upload/
      modern.config.[tj]s
      Runtime
      Core
      createRoot
      render
      Router
      router
      SSR
      NoSSR
      renderStreaming
      renderString
      createRequestHandler
      BFF
      useHonoContext
      Utility
      CSS-In-JS API
      Head
      loadable
      📝 Edit this page
      Previous pagemock/Next pageupload/

      #public/

      Any static assets can be placed in the public/ directory, and the files will be deployed to the corresponding application domain by the server.

      #Description

      The file routing is based on the convention of the directory structure, where public/ is the root directory corresponding to the root path of the Web application.

      For example, the config/public/sdk/index.js file will be deployed under ${domain}/sdk/index.js after deployment.

      #Scenarios

      For example, authentication files required by third-party systems such as robots.txt and auth.xml.

      Or SDKs for other business parties (requiring unchanged routing), or HTML files without entry.

      Info

      For static assets (such as SVG images) that need to be imported through import in the source code, it is recommended to manage them in the src/assets directory.

      #Code Compression

      If the file in the directory is a .js file, it will be automatically compressed during production environment construction.

      If the file ends with .min.js, it will not be compressed.