Ember.js Framework Core
Ember.js is a productive, battle-tested JavaScript framework for building ambitious web applications. The `ember-source` package provides the core runtime and build-time components of the Ember framework, including the Glimmer rendering engine and the Ember object model. As of its current stable version 6.12.0, Ember continues to offer a 'convention over configuration' approach, emphasizing stability and developer ergonomics through a structured ecosystem. Releases typically follow a six-week cycle for minor versions, with LTS (Long Term Support) releases provided periodically. Key differentiators include its comprehensive toolchain (Ember CLI), a robust data layer (Ember Data), and a strong commitment to backward compatibility and upgrades via 'editions' and 'octane' paradigms. The framework is designed for applications with long lifecycles, offering features like a strong routing solution, reactive programming primitives, and an opinionated component model.
Common errors
-
Cannot find module '@glimmer/component' or its corresponding type declarations.
cause Ember applications or addons using Glimmer components might miss the `@glimmer/component` dependency, or the build system isn't correctly configured to resolve it after the monorepo merge.fixEnsure `@glimmer/component` is listed in your `package.json` peerDependencies (for addons) or dependencies (for apps) and that `ember-source` is at a compatible version. If on v6.12.0+, verify your Ember CLI version is recent enough to handle the internal Glimmer VM changes. -
TypeError: GlimmerComponent is not a constructor
cause This error likely occurs after upgrading to Ember v6.11.0 or later, where the default export `GlimmerComponent` from `@glimmer/component` was renamed.fixChange your import statement from `import GlimmerComponent from '@glimmer/component';` to `import Component from '@glimmer/component';`. -
Error: Assertion Failed: You must use 'tracked' to mark properties that you intend to use in a template or update reactively.
cause A property used in a template or relied upon for reactivity was modified, but not decorated with `@tracked`.fixAdd the `@tracked` decorator from `@glimmer/tracking` to any component property whose changes should trigger a re-render or be reactive.
Warnings
- breaking As of v6.12.0, the Glimmer VM and all `@glimmer/*` packages are merged directly into the `emberjs/ember.js` monorepo. This primarily affects core contributors and integrators, simplifying internal iteration, but might subtly change dependency resolution or tree-shaking behavior in specific edge cases for advanced build setups.
- breaking The default export `GlimmerComponent` from `@glimmer/component` was renamed to `Component` to improve developer experience and autocomplete. Code directly importing `GlimmerComponent` will break.
- gotcha Ember's module resolution typically requires using `import` statements at the top level, even though `ember-source` itself ships CommonJS bundles for Node.js environments (like FastBoot). Direct `require()` calls for framework internals are generally discouraged in application code.
- gotcha Using `ApplicationInstance#visit` might throw a `TransitionAborted` error if not handled correctly, especially in FastBoot or during rapid navigation/redirects.
- gotcha FastBoot environments experienced crashes during component/application destruction, particularly with complex component hierarchies.
Install
-
npm install ember-source -
yarn add ember-source -
pnpm add ember-source
Imports
- Component
import { Component } from '@ember/component';import Component from '@glimmer/component';
- tracked
import { tracked } from '@ember/object';import { tracked } from '@glimmer/tracking'; - action
import { action } from '@ember/component';import { action } from '@ember/object';
Quickstart
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
interface Args {
message: string;
}
export default class GreetingComponent extends Component<Args> {
@tracked count = 0;
get greeting() {
return `${this.args.message} World! You clicked ${this.count} times.`;
}
@action
increment() {
this.count++;
}
// Example of a lifecycle hook
constructor(owner: unknown, args: Args) {
super(owner, args);
console.log('GreetingComponent initialized with message:', this.args.message);
}
}