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

[Examples] npm run develop slower/bigger than it has to be #6368

Closed
kungfooman opened this issue May 15, 2024 · 1 comment · Fixed by #6588
Closed

[Examples] npm run develop slower/bigger than it has to be #6368

kungfooman opened this issue May 15, 2024 · 1 comment · Fixed by #6588
Assignees

Comments

@kungfooman
Copy link
Collaborator

// Don't include all of 'playcanvas' for these defines, it just
// causes bigger bundles and prolongs the build time by ~3s.
import {
DEVICETYPE_WEBGL2,
DEVICETYPE_WEBGPU,
DEVICETYPE_NULL
} from 'playcanvas';

Previously we had:

// Don't include all of 'playcanvas' for these defines, it just
// causes bigger bundles and prolongs the build time by ~3s.
import {
    DEVICETYPE_WEBGL1, DEVICETYPE_WEBGL2, DEVICETYPE_WEBGPU, DEVICETYPE_NULL
} from 'playcanvas/src/platform/graphics/constants.js';

(hence the comment)

For some reason it was refactored and the comment was neither read nor removed.

The Examples UI doesn't really require PlayCanvas, it's like a fancy UI to pick content for an <iframe>, as the only function is to render the UI. It depends on exactly three constants for the DeviceSelector. These three constants add like 2-3 seconds build time and append an unused extra of ~1.7MB to generate examples/dist/index.js on every Ctrl+S now.

So possible actions are:

  1. Keep it slow and oversized
  2. Reimplement how it was
  3. Just write them out without messing around with the imports, for example:
const DEVICETYPE_NULL = 'null';
const DEVICETYPE_WEBGL2 = 'webgl2';
const DEVICETYPE_WEBGPU = 'webgpu';
  1. Any better ideas?
@kpal81xd
Copy link
Contributor

It shouldn't include the entire of playcanvas on the latest version cos of treeshaking during rollup? I will take a look

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

Successfully merging a pull request may close this issue.

3 participants