playcanvas / playcanvas/editor
Ability to exclude a script from concatenation
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.3k
- Forks
- 215
- Avg merge
- 1d 29m
- Merged PRs (30d)
- 30
Description
This may sound like a stretch case but there is a simple and important use case that can benefit from it:
- using PlayCanvas .js assets to spawn web workers.
This code will fail if script concatenation is enabled either on launch or on a build:
const workerScript = this.app.assets.find('worker.js', 'script');
const worker = new Worker(workerScript.getFileUrl());
The alternative right now is quite nasty:
- Have
worker.jsbeworker.txt(text asset) - Load its contents in a Blob with an
application/javascriptmimetype - Feed that blob to the Worker constructor using
URL.createObjectURL(blob).
It works, but it's not great to edit code in a txt file.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start from the editor's script-concatenation and build entry points; the issue does not name specific files or tests. Reproduce the Worker failure with a PlayCanvas .js asset, then determine how an asset can be excluded from concatenation while normal scripts retain their existing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- build-system, frontend, web-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100