Skip to content

Upload & Publish ​

This page walks through publishing a local component to the platform. The first publish must go through here; later iterations are covered in Update & Versioning.

Checks before uploading ​

  • [ ] The component is a standalone folder containing an entry file (see Component Spec).
  • [ ] The dependencies in use are present in the current project's node_modules.
  • [ ] Single file ≤ 3 MB, total size ≤ 10 MB, file count ≤ 30.
  • [ ] The component name is PascalCase or kebab-case and does not clash with an existing one.
  • [ ] A README.md is prepared, with props and events clearly documented.

Publishing in five steps ​

1. Open the upload page ​

After starting the local service, click "Upload Component" in the left menu.

2. Select the component directory ​

The file tree on the left shows the directory specified by dir in the configuration file. Navigate to the component folder, select it and click "Select".

3. Configure the preview ​

The upper part of the page is a live preview; the lower part is the configuration area:

SettingDescription
Mini PreviewThe file shown on list cards, by convention demo/index.vue
Full-Screen PreviewThe file shown on the detail page, by convention demo/full.vue
Component DependenciesAuto-scanned from the source; check for anything missing before publishing
RemarksOne sentence describing what the component is for
Additional InfoA longer description that also feeds search keywords

For Vue / React pick .vue / .jsx / .tsx files; for Web Components pick .html files.

4. Generate the configuration ​

Click "Generate Configuration" and the platform writes comp.json:

json
{
  "__id__": "xxxxxxxxxxxxxxxxxxxxxxxx",
  "name": "MyComponent",
  "version": "1.0.0"
}

After the first successful publish the server writes __id__ back. Do not edit it by hand — it is how the component is identified on later updates.

5. Publish ​

Once the preview and dependencies look right, click "Publish". After a successful publish the component appears in "My Components" and enters the component market according to the recommendation rules.

How the framework is detected ​

The platform applies the following rules in order and stops at the first match:

  1. index.vue exists → Vue.
  2. index.jsx / index.tsx exists → React.
  3. Any source file contains customElements.define( or extends HTMLElement → Web Component.
  4. index.js exists with no custom element registration → React.
  5. No match → no default is given and you must choose on the upload page.

"Component Framework" under "Additional Info" on the upload page overrides the detection result — the UI selection wins.

Do not depend on both vue and react in one component

Otherwise the framework cannot be determined, and both checking and rendering fail.

Duplicate components ​

The platform performs similarity detection. When a component is judged a duplicate:

  • It does not enter the "Recommended", "Popular" or "Latest" lists.
  • It is only visible in "My Components".
  • It appears in the recommendations of similar components.
  • Updates get no recommendation weight either.

Searching for an existing component of the same kind before uploading saves a round of rework.

First publish versus updates ​

First publishLater updates
EntryUpload pageUpdate page or comphub upload
Creates the componentYes, and writes __id__No, only adds a version
Preview / description editableYesUpdate page: yes; CLI: no
Version numberInitial versionCode changes require a bump

Troubleshooting a failed publish ​

SymptomCauseFix
A missing dependency is reportedThe dependency is not installed in the current projectRun npm install <pkg> in the project root
Component has no default exportThe React entry only has named exportsChange it to export default
The Web Component preview reports that no module script was foundThe HTML has no <script type="module">, or it sits in <head>Move it into <body>
The preview is blank with no terminal errorAn alias was used for an asset path, or a dependency spans a major versionSwitch to relative paths and check the dependency
A file limit is reportedSingle file > 3 MB / total > 10 MB / count > 30Compress assets or split the component

Next steps ​

Components uploaded by users are open source