-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Type of Change
- New Feature Request
- Documentation / Website
- Improvement / Suggestion
- Bug
- Other (please clarify below)
Summary
Doing some discovery as part of #523 to validate Greenwood works correctly with a variety of frameworks and libraries, have a couple more improvements to update here regarding integration work in progress with Lion -ProjectEvergreen/greenwood-getting-started#45.
Details
"Flat" Export Map
Was getting an error that one Lion's export maps entries (./define) was not resolving correctly
es-module-shims.js:469 Uncaught (in promise) Error: Unable to resolve specifier '@lion/button/define' from http://localhost:1984/?0
at throwUnresolved (es-module-shims.js:469)
at resolve (es-module-shims.js:465)
at es-module-shims.js:424
at Array.map (<anonymous>)
at es-module-shims.js:423
at async loadAll (es-module-shims.js:237)
at async topLevelLoad (es-module-shims.js:256)
I think the issue is I was not correctly handling "flat" export maps, e.g.
Lit - each entry is an object
"exports": {
".": {
"default": "./index.js"
},
"./async-directive.js": {
"default": "./async-directive.js"
},
"./decorators.js": {
"default": "./decorators.js"
},
"./decorators/custom-element.js": {
"default": "./decorators/custom-element.js"
},
...
}Lion - each entry is a string
"exports": {
".": "./index.js",
"./define": "./lion-calendar.js",
"./translations/*": "./translations/*",
"./test-helpers": "./test-helpers/index.js",
"./docs/": "./docs/"
} Transient Imports
After fixing the above, I then saw that an import of a dependent package was not correctly getting updated in the import map when walking a module.
es-module-shims.js:469 Uncaught (in promise) Error: Unable to resolve specifier '@bundled-es-modules/message-format/MessageFormat.js' from http://localhost:1984/node_modules/@lion/localize/src/LocalizeManager.js
at throwUnresolved (es-module-shims.js:469)
at resolve (es-module-shims.js:465)
at es-module-shims.js:424
at Array.map (<anonymous>)
at es-module-shims.js:423Not sure if this is just bad export map reading on my end, but presumably all
importstatements needs to be registered in the import map somewhere, right?
There might be some other fixes needed as part of working with MWC and the double scoped namespace bug seen, but will save that for another issue / PR.

