DEV: Extract global compat code into module (#20901)
Moves a couple things from discourse-boot.js to a different JS file imported from app/app.js. This is a forwards compatible technique to import and throw data on the window. One thing to make note of, though, is that if the virtual-dom and discourse-widget-hbs/helpers were previously included in the build elsewhere, they will now become part of the app bundle. Later, when using embroider, all bundles will be chunks, and webpack will optimize which chunk contains which modules appropriately.
This commit is contained in:
parent
9014cd6a6f
commit
97d8614811
|
@ -1,3 +1,5 @@
|
||||||
|
import "./global-compat";
|
||||||
|
|
||||||
import Application from "@ember/application";
|
import Application from "@ember/application";
|
||||||
import { buildResolver } from "discourse-common/resolver";
|
import { buildResolver } from "discourse-common/resolver";
|
||||||
import { isTesting } from "discourse-common/config/environment";
|
import { isTesting } from "discourse-common/config/environment";
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
import virtualDom from "virtual-dom";
|
||||||
|
import widgetHelpers from "discourse-widget-hbs/helpers";
|
||||||
|
|
||||||
|
window.__widget_helpers = widgetHelpers;
|
||||||
|
|
||||||
|
// TODO: Eliminate this global
|
||||||
|
window.virtualDom = virtualDom;
|
|
@ -10,11 +10,6 @@
|
||||||
// https://github.com/emberjs/ember.js/blob/0c5518ea7b/packages/%40ember/-internals/glimmer/lib/helper.ts#L134-L138
|
// https://github.com/emberjs/ember.js/blob/0c5518ea7b/packages/%40ember/-internals/glimmer/lib/helper.ts#L134-L138
|
||||||
require("ember");
|
require("ember");
|
||||||
|
|
||||||
window.__widget_helpers = require("discourse-widget-hbs/helpers").default;
|
|
||||||
|
|
||||||
// TODO: Eliminate this global
|
|
||||||
window.virtualDom = require("virtual-dom");
|
|
||||||
|
|
||||||
let element = document.querySelector(
|
let element = document.querySelector(
|
||||||
`meta[name="discourse/config/environment"]`
|
`meta[name="discourse/config/environment"]`
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue