discourse/app/assets/javascripts/patches
Godfrey Chan e1373c3e84
DEV: introduce Embroider behind a flag, and start testing in CI (#23005)
Discourse core now builds and runs with Embroider! This commit adds
the Embroider-based build pipeline (`USE_EMBROIDER=1`) and start
testing it on CI.

The new pipeline uses Embroider's compat mode + webpack bundler to
build discourse code, and leave everything else (admin, wizard,
markdown-it, plugins, etc) exactly the same using the existing
Broccoli-based build as external bundles (<script> tags), passed
to the build as `extraPublicTress` (which just means they get
placed in the `/public` folder).

At runtime, these "external" bundles are glued back together with
`loader.js`. Specifically, the external bundles are compiled as
AMD modules (just as they were before) and registered with the
global `loader.js` instance. They expect their `import`s (outside
of whatever is included in the bundle) to be already available in
the `loader.js` runtime registry.

In the classic build, _every_ module gets compiled into AMD and
gets added to the `loader.js` runtime registry. In Embroider,
the goal is to do this as little as possible, to give the bundler
more flexibility to optimize modules, or omit them entirely if it
is confident that the module is unused (i.e. tree-shaking).

Even in the most compatible mode, there are cases where Embroider
is confident enough to omit modules in the runtime `loader.js`
registry (notably, "auto-imported" non-addon NPM packages). So we
have to be mindful of that an manage those dependencies ourselves,
as seen in #22703.

In the longer term, we will look into using modern features (such
as `import()`) to express these inter-dependencies.

This will only be behind a flag for a short period of time while we
perform some final testing. Within the next few weeks, we intend
to enable by default and remove the flag.

---------

Co-authored-by: David Taylor <david@taylorhq.com>
2023-09-07 13:15:43 +01:00
..
@ember+jquery+2.0.0.patch
@ember+legacy-built-in-components+0.4.2.patch DEV: introduce Embroider behind a flag, and start testing in CI (#23005) 2023-09-07 13:15:43 +01:00
babel-plugin-debug-macros+0.3.4.patch DEV: Move from babel-plugin-debug-macros fork to in-repo patch (#22702) 2023-09-05 18:07:56 +01:00
ember-source+3.28.12.patch DEV: Update ember-cli to 5.0.0 (#22280) 2023-06-26 17:15:59 +02:00
ember-this-fallback+0.3.1+001+initial.patch DEV: Apply ember-this-fallback patches sequentially (#23407) 2023-09-05 12:50:15 +02:00
ember-this-fallback+0.3.1+002+themes.patch DEV: Apply ember-this-fallback patches sequentially (#23407) 2023-09-05 12:50:15 +02:00
virtual-dom+2.1.1.patch