discourse/app
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
..
assets DEV: introduce Embroider behind a flag, and start testing in CI (#23005) 2023-09-07 13:15:43 +01:00
controllers DEV: Handle bad parameters in TopicsController#wordpress (#23404) 2023-09-05 16:35:46 +08:00
helpers DEV: Switch to using standard ember-cli test bundle (#23337) 2023-09-04 17:09:55 +01:00
jobs DEV: there is no need anymore to wrap export methods into enumerators (#22567) 2023-08-17 22:09:58 +04:00
mailers FIX: Order tags shown in email subject by topics count and name (#22586) 2023-07-13 15:39:58 +08:00
models FEATURE: Secure uploads in PMs only (#23398) 2023-09-06 09:39:09 +10:00
serializers FIX: Don't mix up action labels between different reviewables (#23365) 2023-09-06 10:57:30 +08:00
services FIX: Everyone should be aware a cached summary is outdated. (#23438) 2023-09-06 12:09:21 -03:00
views DEV: introduce Embroider behind a flag, and start testing in CI (#23005) 2023-09-07 13:15:43 +01:00