3.4.8 • Published 2 days ago

@embroider/compat v3.4.8

Weekly downloads
2,827
License
MIT
Repository
github
Last release
2 days ago

Embroider: a modern build system for EmberJS apps

GitHub Actions CI

This repo implements a new three-stage build system for Ember apps:

  1. The first stage achieves backward compatibility by building each classic Ember Addon package into a new v2 package format. This makes each package much more static and analyzable. The eventual goal is to do less and less work in this stage, as addons publish to NPM natively in v2 format.

  2. The second stage takes a collection of v2-formatted addons plus an application and "compiles out" all Ember-specific conventions, such that the output can be understood by any tool that can handle standards-compliant Javascript. This stage is setup with good inputs and outputs that make it much easier to benefit from incremental improvements to our dependency analysis. The immediate goal is not to implement every possible optimization, but rather to make a good place for those optimizations to happen.

  3. The third stage ("final packaging") can be handled by existing tools like Webpack, Rollup, or Parcel with only a small amount of configuration. Not because we want to force every Ember developer to choose and configure one of these tools! But because a stable, standards-compliant API between stage 2 and 3 improves our ability to innovate and experiment with taking the best parts of wider JS ecosystem tooling.

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

Status / Should I Use It?

This is beta-quality software. Teams are encouraged to test their apps and addons using Embroider and report bugs. We need more real-world testing before we can hit stable 1.0 and integrate into ember-cli as the default build pipeline.

The main risks to be aware of if you choose to use Embroider in production are:

  • you're likely to discover some Ember addons don't work or break your build
  • Embroider's own configuration options are subject to change, so you'll need to read the CHANGELOG.md when updating the Embroider packages.

For Addon Authors

The v2 Addon Format RFC is the official spec for the packages that Embroider natively handles. Addon authors should see ADDON-AUTHOR-GUIDE.md for advice on how to get their addons ready for Embroider.

How to try it

  1. Add dependencies:

    yarn add --dev @embroider/core @embroider/compat @embroider/webpack
  2. Edit ember-cli-build.js:

    -return app.toTree();
    +const { Webpack } = require('@embroider/webpack');
    +return require('@embroider/compat').compatBuild(app, Webpack);

    Alternatively, if you are passing optional extra broccoli trees into app.toTree(), you can rewrite like:

    -return app.toTree(extraTreeHere);
    +const { Webpack } = require('@embroider/webpack');
    +return require('@embroider/compat').compatBuild(app, Webpack, {
    +  extraPublicTrees: [extraTreeHere]
    +});
  3. Use ember serve, ember test, and ember build as usual.

Options

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

return require('@embroider/compat').compatBuild(app, Webpack, {
  // staticAddonTestSupportTrees: true,
  // staticAddonTrees: true,
  // staticHelpers: true,
  // staticComponents: true,
  // packagerOptions: {
  //    webpackConfig: { }
  // }
});

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

The recommended steps when introducing Embroider into an existing app are:

  1. First make it work with no options. This is the mode that supports maximum backward compatibility.
  2. Enable staticAddonTestSupportTrees and staticAddonTrees and test your application. This is usually safe, because most code in these trees gets consumed via import statements that we can analyze. But you might find exceptional cases where some code is doing a more dynamic thing.
  3. Enable staticHelpers and test. This is usually safe because addons get invoke declarative in templates and we can see all invocations.
  4. Enable staticComponents, and work to eliminate any resulting build warnings about dynamic component invocation. You may need to add packageRules that declare where invocations like {{component someComponent}} are getting someComponent from.
  5. Once your app is working with all of the above, you can enable splitAtRoutes and add the @embroider/router and code splitting should work.

Analyzing Bundles

see ANALYZING.md

Contributing

see CONTRIBUTING.md

License

This project is licensed under the MIT License.

Acknowledgements

Thanks to Cardstack for sponsoring Embroider's development.

3.4.8

9 days ago

3.4.7

17 days ago

3.4.6

2 months ago

3.4.5

2 months ago

3.4.4

3 months ago

3.4.3

4 months ago

3.4.2

5 months ago

3.4.1

5 months ago

3.2.2

7 months ago

3.2.1

9 months ago

3.2.0

9 months ago

3.2.3

7 months ago

3.1.3

10 months ago

3.1.2

10 months ago

3.1.1

10 months ago

3.1.0

10 months ago

3.1.5

10 months ago

3.1.4

10 months ago

3.4.0

5 months ago

3.3.1

5 months ago

3.3.0

6 months ago

3.0.2

11 months ago

3.0.1

11 months ago

3.0.0

12 months ago

2.1.1

1 year ago

2.1.0

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.9.0

2 years ago

1.8.2

2 years ago

1.8.1

2 years ago

1.8.3

2 years ago

1.8.0

2 years ago

1.7.1

2 years ago

1.7.0

2 years ago

1.6.0

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.5.0

2 years ago

0.49.0

2 years ago

1.0.0

2 years ago

1.4.0

2 years ago

1.3.0

2 years ago

0.50.1

2 years ago

0.50.2

2 years ago

0.50.0

2 years ago

0.48.0

2 years ago

0.48.1

2 years ago

0.47.2

2 years ago

0.47.1

3 years ago

0.46.2

3 years ago

0.46.0

3 years ago

0.46.1

3 years ago

0.47.0

3 years ago

0.45.0

3 years ago

0.44.2

3 years ago

0.44.1

3 years ago

0.44.0

3 years ago

0.44.0-alpha.2

3 years ago

0.43.5

3 years ago

0.43.4

3 years ago

0.44.0-alpha.1

3 years ago

0.44.0-alpha.0

3 years ago

0.43.3

3 years ago

0.43.2

3 years ago

0.43.1

3 years ago

0.43.0

3 years ago

0.42.3

3 years ago

0.42.2

3 years ago

0.42.1

3 years ago

0.42.0

3 years ago

0.41.0

3 years ago

0.40.0

3 years ago

0.38.0

3 years ago

0.39.1

3 years ago

0.39.0

3 years ago

0.38.0-alpha.3

3 years ago

0.38.0-alpha.2

3 years ago

0.38.0-alpha.1

3 years ago

0.38.0-alpha.0

3 years ago

0.37.0

3 years ago

0.36.0

3 years ago

0.35.1

3 years ago

0.35.0

3 years ago

0.34.0

3 years ago

0.33.0

3 years ago

0.32.0

3 years ago

0.31.0

3 years ago

0.30.0

3 years ago

0.29.0

4 years ago

0.28.0

4 years ago

0.27.0

4 years ago

0.26.0

4 years ago

0.25.0

4 years ago

0.24.1

4 years ago

0.24.0

4 years ago

0.23.0

4 years ago

0.22.0

4 years ago

0.21.0

4 years ago

0.20.0

4 years ago

0.19.0

4 years ago

0.19.0-alpha.0

4 years ago

0.18.0

4 years ago

0.17.0

4 years ago

0.16.1

4 years ago

0.16.0

4 years ago

0.15.0

4 years ago

0.14.0

4 years ago

0.13.0

4 years ago

0.12.0

4 years ago

0.11.1

4 years ago

0.11.0

4 years ago

0.10.0

4 years ago

0.9.0

4 years ago

0.8.0

4 years ago

0.7.1

5 years ago

0.7.0

5 years ago

0.6.0

5 years ago

0.5.1

5 years ago

0.5.0

5 years ago

0.4.3

5 years ago

0.4.2

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.5

5 years ago

0.3.4

5 years ago

0.3.3

5 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago