-
-
Notifications
You must be signed in to change notification settings - Fork 227
Support import url vanilla ES6 modules. #210
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
Comments
URL imports aren't supported in node or the browser environments. Why would you use them? Is this for use in |
@pastelsky URL import browser support is actually quite high: https://caniuse.com/#search=modules |
Bundlephobia supports ESM imports that are resolve-able via the filesystem. I was specifically talking about this syntax - import jsincss from 'https://unpkg.com/jsincss/index.vanilla.js' Or importing a package via HTTP, which I don't think is valid javascript. |
@pastelsky Trust me that is valid Javascript. I understand if it looks foreign if you come from Node. Note that the ECMA module spec is not tied to Node's implementation. As I mentioned in my first post, I am not aware of a convention for specifying these dependencies. Perhaps bundlephobia could support a package.json key: "nativeDependencies": {
"https://unpkg.com/jsincss": "jsincss"
} In this way, even if bundlephobia remains tied to Node's current module resolution, a fallback could be provided with an npm package name. |
Well, TIL. Apologies for pre judgement. This issue should perhaps be opened with webpack? It probably needs to ignore URLs. Else if there are resolver plugins / loaders that handle URLs in imports, I'll be happy to add them to bundlephobia |
Please describe the feature/suggestion
Currently, modules that use vanilla ES6 imports of a library do not work.
Example:
https://bundlephobia.com/result?p=deqaf
https://github.com/tomhodgins/deqaf/blob/master/index.js
Describe the solution you'd like
It is not clear if there is even a convention for listing these dependencies in a package.json file.
Ideally these could be handled natively when a https import is detected.
Describe any alternatives you've considered
Some options would be to try to parse jsdelivr and unpkg urls to determine the npm package. A better approach would be to just download the file and include the size in the bundle size calculation.
The text was updated successfully, but these errors were encountered: