Skip to content

Add dev builds to speed up dev iteration #30865

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

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open

Add dev builds to speed up dev iteration #30865

wants to merge 2 commits into from

Conversation

ycw
Copy link
Contributor

@ycw ycw commented Apr 4, 2025

fix: #30829

Description

Idea #30851 (comment) is that creating stub build files to speed up dev iteration, and no bundling at all, e.g. content of build/three.module.js is now:

// dev mode
export * from '../src/Three.js';

This way build time is negligible, and /src can be reflected in devtools. Header comments is added to build files, so that the existent of /build is more reasonable upon debugging. Since dev phase and preview phase are now split, I added two npm scripts for verifying real build files.

In dev phase, users should run npm run dev or npm run dev-ssl

In preview phase, users should run npm run preview or npm run preview-ssl

Copy link

github-actions bot commented Apr 4, 2025

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 336.44
78.37
336.44
78.37
+0 B
+0 B
WebGPU 541.67
150.04
541.67
150.04
+0 B
+0 B
WebGPU Nodes 541.14
149.93
541.14
149.93
+0 B
+0 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 465.37
112.21
465.37
112.21
+0 B
+0 B
WebGPU 614.51
166.09
614.51
166.09
+0 B
+0 B
WebGPU Nodes 569.5
155.49
569.5
155.49
+0 B
+0 B

@gkjohnson
Copy link
Collaborator

cc @Mugen87 @mrdoob @donmccurdy what do you think of a solution like this? I'm not sure if we need a "preview" script but this kind of solution would fix the recent issues associated with dev build times.

@RenaudRohlinger
Copy link
Collaborator

This PR is a huge improvement. I’ve never relied on the current build outputs during development and always end up manually rewriting imports to point to src/.
I’ve noticed I’m not alone, many of Sunag’s PRs also include ../../src paths in the examples, which suggests a similar workflow.

Having this streamlined setup will make iteration smoother for everyone.

@gkjohnson
Copy link
Collaborator

Agreed - I think this should be merged. There have been a lot of reasons provided for why this is a valuable improvement and not a lot provided for why it's harmful to the dev process. To me it's clear from using the current dev workflow and from how other maintainers are modifying files for development that the current build time is only a drag on the current dev process.

Copy link
Collaborator

@Mugen87 Mugen87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I'm convinced. If multiple collaborators want this change because it improves their workflows, I don't want to be the one who blocks it 😅 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Three.js dev iteration process, bundling has become really slow
4 participants