Skip to content

Commit

Permalink
🧩: fix esm module url resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
merryman committed Dec 10, 2024
1 parent f833740 commit 1e186fc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions lively.modules/src/packages/package-registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ export class PackageRegistry {
findPackageHavingURL (url) {
// does url identify a resource inside pkg, maybe pkg.url === url?
if (url.isResource) url = url.url;
if (url.startsWith('esm://')) return null;
if (url.endsWith('/')) url = url.slice(0, -1);
if (this.moduleUrlToPkg.has(url)) return this.moduleUrlToPkg.get(url);
let penaltySoFar = Infinity; let found = null; let { byURL } = this;
Expand Down Expand Up @@ -454,7 +453,7 @@ export class PackageRegistry {
let pkg = (existingPackageMap && existingPackageMap[url]) ||
new Package(this.System, url);
let config = await pkg.tryToLoadPackageConfig();
if (url.includes('local_projects')){
if (url.includes('local_projects')) {
const forkInfoFile = resource(url).join('.livelyForkInformation');
if ((await forkInfoFile.exists())) {
const forkInfo = JSON.parse((await forkInfoFile.read()));
Expand Down
2 changes: 1 addition & 1 deletion lively.modules/src/system.js
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ async function normalizeHook (proceed, name, parent, parentAddress) {
const indexjs = stage3.replace('.js', '/index.js');
if (await checkExistence(indexjs, System) || !isNodePath) return indexjs;
return stage3.replace('.js', '/index.node');
} else if (!stage3.includes('jspm.dev') && stage3 !== '@empty') {
} else if (!stage3.startsWith('esm://') && !stage3.includes('jspm.dev') && stage3 !== '@empty') {
if (await checkExistence(stage3 + '.js', System)) return stage3 + '.js';
if (await checkExistence(stage3 + '/index.js', System)) return stage3 + '/index.js';
}
Expand Down

0 comments on commit 1e186fc

Please sign in to comment.