Skip to content

Compiling Ember apps into spec-compliant, modern Javascript.

License

Notifications You must be signed in to change notification settings

embroider-build/embroider

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Embroider: translating existing Ember code into spec-compliant modern JavaScript

GitHub Actions CI

This repo implements the Embroider translation layer and resolver that is used to allow modern build tooling with Ember Apps.

You can read more about the motivation and key ideas in the intro to the SPEC.

Status / Should I Use It?

There is an accepted RFC that will make the Embroider build system the default for all newly generated Ember apps i.e. when you run ember new my-app it will generate an Ember app that is built with Vite with this Embroider resolver installed as a plugin.

If you don't want to wait until that RFC has been fully implemented you can try out the ember-vite-codemod which will guide you through updating your existing applications or you can try the current draft blueprint for an Embroider based Ember ember app and follow the instructions on that README.

Embroider with Vite is considered production ready so you should try it out and let us know if you discover any issues with your Applications

For Addon Authors

Addon authors should see ADDON-AUTHOR-GUIDE.md for advice on how to get their existing addons ready for Embroider.

The v2 Addon Format RFC is the official spec for the packages that Embroider natively handles. Common patterns and best practices for authoring these have been collected in the v2 addon FAQs. For creating a new v2 addon from scratch, we recommend using our v2 addon blueprint. For porting existing v1 addons, we refer to the v2 porting guide.

Options

You can pass options into Embroider by passing them into the compatBuild function like:

// ember-cli-build.js
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
const { compatBuild } = require('@embroider/compat');

module.exports = async function (defaults) {
  const { buildOnce } = await import('@embroider/vite');
  let app = new EmberApp(defaults, {});

  return compatBuild(app, buildOnce, {
    staticInvokables: true, // this is the default so you don't need to set it
    splitAtRoutes: ['route.name'], // can also be a RegExp
  );
};

The options are documented in detail in Core Options and Compat Options

Environment variables

For optional features, Embroider supports the following environment variables:

  • EMBROIDER_WORKING_DIRECTORY: by default Embroider writes internal build-time artifacts like rewritten packages to node_modules/.embroider. In the case of running multiple builds concurrently (e.g. building for production and test in parallel) this would cause conflicts when concurrent processes try to write into the same directory. For this case you can point each Embroider process to a different directory using this environment variable. It can be an absolute file path, or relative to the application root directory.

Compatibility

Ember version

Requires Ember 3.28.11 or greater

Contributing

see CONTRIBUTING.md

License

This project is licensed under the MIT License.

Acknowledgements

Thanks to Cardstack for sponsoring Embroider's development.

Thanks to the Embroider Initiative sponsors for contributing to Embroider's development: