跪拜 Guibai
← Back to the summary

Cocos Creator Projects Keep Arriving as 1GB Zips — Here's What to Strip Out

Cover image

Introduction

Hello everyone, I am Yiyuan Programmer, a lead programmer with 8 years of experience in the game industry.

Recently, the most frequent thing in my private messages is not error screenshots, but compressed packages.

Brother Yi, the project won't open. I'll package it up and send it to you to take a look.

Then a file pops in:

Good grief, a 1G mega project

After downloading and extracting, the assets folder is only a few dozen megabytes. The rest is all library, temp, build.

Don't package, don't package, don't package!

I don't know how many times I've said it:

library, temp, build, don't package them, don't package them, don't package them!

It seems many friends still don't understand the Cocos project directory, leading to sending not a project, but a data bomb.

Getting back to the point, in this issue, follow me to see what the Cocos project structure looks like and how to package it most conveniently.

The example project for this article is available at the end; friends can go get it themselves.

What exactly are these folders in a Cocos project for?

How can a Cocos Creator 3.x project be recognized by the editor?

The minimum configuration is actually just two things: assets + package.json.

After opening, it will also generate library, temp, local by itself. They all look like part of the project, but they actually fall into two categories:

Data bombs usually come from the second type. Five minutes to package, two hours to download.

1. Must take with you (so others can open it)

Path Plain language
assets/ (including all .meta) Most important, 99% of daily work happens here
package.json Project identifier file, the engine relies on it to recognize this as a Cocos project
settings/ Project settings, usually grouping configurations, can be ignored in extreme cases
tsconfig.json TS syntax / type configuration, can be ignored in extreme cases

2. Don't package (can be regenerated after deletion)

Path Why it can be thrown away
library/ Import cache, rebuilt when the project opens, usually the largest
temp/ Temporary files
local/ Your window layout, taking it only pollutes others' editors
build/ Build artifacts, that's a 'release package' not a 'source project'
node_modules/ .git/ Dependencies (keep the declaration) and version library, don't stuff into a shared package

3. Depending on the situation (either way)

Path What it does
extensions/ Project's own extensions, keep if present
profiles/ Build configurations, general editor configurations
native/ Native content, keep if needed
.gitignore git ignore list
.codex/ .cursor/ .claude/ Intermediate products of AI programming tools (Codex / Claude Code / Cursor)

The above is the core directory explanation for Cocos 3.8.7. Friends can learn more through the official documentation.

Summary:

Category Suggested content
Minimum recognition conditions assets/, package.json
Default keep for streamlined project assets/, settings/, package.json, tsconfig.json
Keep per project extensions/, profiles/, native/, dependency lock files, project custom files
Default exclude library/, temp/, local/, build/, node_modules/, .git/
Decide after checking .codex/, .cursor/, .claude/ and configs containing accounts, keys, local paths

So what's the easiest way to package?

Once you understand the directories, compression is just three steps: keep what must be taken, throw away what shouldn't be packaged, and decide on the rest based on the situation.

1. Method 1: Manually delete then compress

After understanding the role of each directory, we can package manually:

  1. Close Creator to avoid file locking.
  2. Copy the project to avoid accidental deletion.
  3. Must delete: library, temp, local, build, node_modules.
  4. Optional delete: profiles, native, unused extensions, decide based on the previous section.
  5. Right-click the remaining content and zip it, send to others.

Just like this

2. Method 2: Compress first, then delete

There's a little trick safer than Method 1:

  1. Zip it first.
  2. Open the zip and delete the unwanted ones.

Saves the copy operation

But here's the problem: You know how to do this, but you'll get annoyed.

3. Method 3: One-click export streamlined project ZIP

Repetitive work shouldn't rely on memory. So I wrote an extension.

How to use?

Menu barProjectExport Streamlined Project ZIPChoose save locationSave.

Solution: As shown in the picture

The default filename is {ProjectName}-min.zip. After extraction, it is a complete project folder; the other party just opens it with the same version of Creator.

The process is just four steps:

  1. Read the root directory of the currently open project (Editor.Project.path).
  2. Under the root directory, only scan folders and files in the whitelist.
  3. When recursively packaging, if a directory name in the exclusion list is encountered, skip it directly.
  4. Write the zip, wrap the root directory with the project name to avoid files scattering after extraction.

The core code is relatively simple:

Keep it if you like, delete it if you don't

The effect is: Originally, five minutes to package, two hours to download; now the core is a few dozen megabytes, ready to open right after sending via WeChat.

Where to put the plugin?

The path is as follows:

%USERPROFILE%\.CocosCreator\builtin-extensions\3.8.7\export-min-project

Windows example:

C:\Users\YourUsername\.CocosCreator\builtin-extensions\3.8.7\export-min-project

After placing it in:

  1. Completely exit Creator, then reopen it.
  2. Open any project, and you will see Export Streamlined Project ZIP in the Project menu.

Why put it here? As explained in a previous article, %USERPROFILE%\.CocosCreator\builtin-extensions\3.8.7\ is the user-level built-in extension directory for Creator 3.8.7. After placing it there, all 3.8.7 projects can use it, no need to copy one for each project.

Of course, you can also use it for a single project only: Place the export-min-project folder into the project's extensions/ directory, and it will only take effect for the current project.

Conclusion

Here's a question: What is the largest project package you have received/given? Tell everyone your number in the comments.

For this article's example project, you can send a private message with "Package Project" to get it.

More practical complete source code including the editor has been integrated into Yiyuan Cocos Mini-Game Practical Collection (Completed). Thank you all for supporting the creation.


I am "Yiyuan Programmer", a lead programmer with 8 years of experience in the game industry. In game development, I hope to help you, and through you, help everyone.

To be honest, I want a like and a heart! Please share this article with other friends you think might need it. Thank you!

Recommended articles:

Yiyuan Cocos Mini-Game Practical Collection 2.0

Yiyuan Cocos Mini-Game Practical Collection 1.0

The boss said this game is very popular lately and told me to copy it, but I can't even figure out how to play it...

This game worth 6.8 billion, aren't you going to practice it? Arrange it!

A friend said my jigsaw puzzle game can't batch with Mask...

Who can't make Tetris... Ah? Quicksand version?

A recently popular jigsaw puzzle game, the boss asked me to make one with Cocos 3.8...

The boss said jigsaw puzzle games are too competitive, asked me to make a 3D version with Cocos...

Dare to challenge replicating the once popular Cut the Rope game with Cocos 3.8?