From 37b347eb5e9e2d16badb170a880e2eed5d2892a9 Mon Sep 17 00:00:00 2001 From: dpiercey Date: Fri, 10 Nov 2023 10:24:08 -0700 Subject: [PATCH] fix: legacy compatibility issue with esm templates and defineWidget --- .changeset/spicy-turtles-travel.md | 5 +++++ .../components-define-widget-legacy/index-browser.js | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/spicy-turtles-travel.md diff --git a/.changeset/spicy-turtles-travel.md b/.changeset/spicy-turtles-travel.md new file mode 100644 index 0000000000..f93748df5a --- /dev/null +++ b/.changeset/spicy-turtles-travel.md @@ -0,0 +1,5 @@ +--- +"marko": patch +--- + +Improve compatibility of legacy Marko widgets loading a template compiled as esm. diff --git a/packages/marko/src/node_modules/@internal/components-define-widget-legacy/index-browser.js b/packages/marko/src/node_modules/@internal/components-define-widget-legacy/index-browser.js index 6c5ac364b0..4a2648853f 100644 --- a/packages/marko/src/node_modules/@internal/components-define-widget-legacy/index-browser.js +++ b/packages/marko/src/node_modules/@internal/components-define-widget-legacy/index-browser.js @@ -320,7 +320,7 @@ module.exports = function defineWidget(def, renderer) { template = req(template); } - registry.r(template.___typeName, function () { + registry.r((template.default || template).___typeName, function () { return Component; }); }