Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to import - rxjs #278

Closed
marcushultman opened this issue Mar 14, 2022 · 5 comments
Closed

Failed to import - rxjs #278

marcushultman opened this issue Mar 14, 2022 · 5 comments
Labels
deno Not working in Deno

Comments

@marcushultman
Copy link
Contributor

Failing module

import 'https://esm.sh/rxjs@7.5.5'

Error message

After running deno run I got this:

error: Uncaught SyntaxError: Detected cycle while resolving name 'ConnectableObservable' in '/v69/rxjs@7.5.5/deno/internal/*.js'
    at <anonymous> (https://cdn.esm.sh/v69/rxjs@7.5.5/deno/internal/observable/ConnectableObservable.js:4:6449)

Additional info

  • esm.sh version: 69
  • Deno version: 1.19.0

Also fails in browser

@marcushultman marcushultman added the deno Not working in Deno label Mar 14, 2022
@ggoodman
Copy link

Looks like it might be a short-coming of the logic here that seems to assume that remapped wildcard submodule prefixes will match:

esm.sh/server/module.go

Lines 105 to 131 in 5ae0819

} else if strings.HasSuffix(name, "/*") && strings.HasPrefix("./"+pkg.Submodule, strings.TrimSuffix(name, "*")) {
/**
exports: {
"./lib/languages/*": {
"require": "./lib/languages/*.js",
"import": "./es/languages/*.js"
},
}
*/
suffix := strings.TrimPrefix("./"+pkg.Submodule, strings.TrimSuffix(name, "*"))
replaced := false
if m, ok := defines.(map[string]interface{}); ok {
for key, value := range m {
if s, ok := value.(string); ok && s != name {
m[key] = strings.Replace(s, "*", suffix, -1)
replaced = true
}
}
} else if s, ok := defines.(string); ok && name != s {
defines = strings.Replace(s, "*", suffix, -1)
replaced = true
}
if replaced {
resolvePackageExports(esm.NpmPackage, defines, target, isDev)
defined = true
}
}

If you look at the packge.json for rxjs@7.5.5, starting on line 60, I think it explains why the linked code might not be working as expected: https://unpkg.com/browse/rxjs@7.5.5/package.json

@ije
Copy link
Member

ije commented Mar 18, 2022

@ggoodman thanks for the details, i am working on it

@ije ije closed this as completed in 1dabda7 Mar 18, 2022
@ije
Copy link
Member

ije commented Mar 18, 2022

fixed in 1dabda7, will release later

@ije
Copy link
Member

ije commented Mar 18, 2022

i also added the rxjs testing, seem works fine in browser: https://esm.sh/?test

@marcushultman
Copy link
Contributor Author

@ije Thank you - it works in Deno too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deno Not working in Deno
Projects
None yet
Development

No branches or pull requests

3 participants