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

Webcomponent imports fail #2010

Open
mitra42 opened this issue Dec 14, 2024 · 0 comments
Open

Webcomponent imports fail #2010

mitra42 opened this issue Dec 14, 2024 · 0 comments

Comments

@mitra42
Copy link

mitra42 commented Dec 14, 2024

What version of async are you using?
3.2.6

Which environment did the issue occur in (Node/browser/Babel/Typescript version)?
Webcomponents (browser)

Is there a compiler in your toolchain? If so, is it targeting ES2017 or later and preserving async functions?
No

What did you do? Please include a minimal reproducible case illustrating issue.
index.html contains

"imports": {
   "async-es": "./node_modules/async-es/index.js"
}
 <script src="./webcomponents.js" type="module"></script>

webcomponents.js contains

import { each } from './node_modules/async-es/index.js'; 

What did you expect to happen?
That it would load the appropriate files (under async-es/index.js) and allow me to call each

What was the actual result?
A string of errors in the console like

       GET http://localhost:8080/node_modules/async-es/unmemoize net::ERR_ABORTED 404 (Not Found)

My (possibly wrong) diagnosis.

This seems to be because index.js contains lines like

import apply from './apply'

which don't specify the .js

I'm guessing this would work in node as it might be able to make the assumption. but browser modules are very picky and want exact filenames which return correct mime-types etc.

Note --- as a workaround, the non-modules version of async, actualy works better in browser modules for some strange reason.

import async from './node_modules/async/dist/async.mjs'; 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant