Introducing ESM Scripts in PlayCanvas
We’re excited to announce a major step forward for PlayCanvas: ESM Scripts are now supported — and officially the recommended way to write scripts in your PlayCanvas projects.
Back in 2016, we introduced what we now call Classic Scripts. At the time, this represented the state of the art in JavaScript. But things have evolved rapidly since then, and developers today expect modern tooling, clearer patterns, and better integration with the broader JavaScript ecosystem.
If you’ve ever struggled with managing classic scripts, wondered why your auto-complete didn’t work, or wished you could reuse code across projects more easily — this is for you.
ESM (ECMAScript Modules) brings modern JavaScript development to the heart of PlayCanvas. It’s faster to get started, easier to scale your project, and way more fun to work with. No more hidden globals. No more messy script loading order. Just well-structured, maintainable, and modular code — exactly how modern web development should be.