René's URL Explorer Experiment


Title: Support for Import Maps · Issue #49443 · nodejs/node · GitHub

Open Graph Title: Support for Import Maps · Issue #49443 · nodejs/node

X Title: Support for Import Maps · Issue #49443 · nodejs/node

Description: I was hoping to start the conversation around getting Import Map support into core. I figured starting here with a proposal was better than starting right off with a PR. What Are Import Maps This proposal allows control over what URLs ge...

Open Graph Description: I was hoping to start the conversation around getting Import Map support into core. I figured starting here with a proposal was better than starting right off with a PR. What Are Import Maps This p...

X Description: I was hoping to start the conversation around getting Import Map support into core. I figured starting here with a proposal was better than starting right off with a PR. What Are Import Maps This p...

Opengraph URL: https://github.com/nodejs/node/issues/49443

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Support for Import Maps","articleBody":"I was hoping to start the conversation around getting [Import Map](https://github.com/WICG/import-maps) support into core.  I figured starting here with a proposal was better than starting right off with a PR.\r\n\r\n## What Are Import Maps\r\n\r\n\u003e This proposal allows control over what URLs get fetched by JavaScript import statements and import() expressions. This allows \"bare import specifiers\", such as import moment from \"moment\", to work.\r\n\r\nThe proposal was mainly targeted at browsers where URL imports have many downsides without bare specifier support.  It enables a standardized map file format to be used when resolving import specifiers, giving developers more control of the behavior of import statements.\r\n\r\nHere is an example of the format:\r\n\r\n```json\r\n{\r\n  \"imports\": {\r\n    \"todayis\": \"node_modules/todayis/index.js\"\r\n  },\r\n  \"scopes\": {\r\n    \"node_modules/todayis\": {\r\n      \"english-days\": \"node_modules/english-days/index.json\"\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nProposal link: https://github.com/WICG/import-maps\r\n\r\n## Why should they be supported in Node.js?\r\n\r\nCurrently we use the structure of the filesystem and a resolution algorithm to map import specifiers to files.  These files are typically installed by a package manager in a structure which the Node.js resolution algorithm knows how to resolve.  This has some drawbacks:\r\n\r\n1. It is slow\r\n2. It can lead to unexpectedly resolving modules\r\n    - if you have a `node_modules` at your filesystem root for example\r\n    - if your package manager has hoisted a transitive dep and you access it from the top level\r\n3. Tools are required to implement copies of the Node.js resolution logic\r\n4. Users and package managers jump through hoops to try and make the filesystem performant\r\n\r\nIf we had import maps we could circumvent most of this.  Package mangers can generate an import map, enabling perf improvements and simplicity in their implementations.  It increases startup performance of apps because they don't have to do as much filesystem access.\r\n\r\nOne interesting example of what import maps enables is filesystem structure independent workspaces (think yarn workspaces but without the requirement of the modules being under the same root directory).\r\n\r\n## Implementation\r\n\r\nAs an example implementation I created this gist:\r\n\r\nhttps://gist.github.com/wesleytodd/4399b2351c59438db19a8ffb1f3fcdca\r\n\r\nTo run it:\r\n\r\n```\r\n$ git clone git@gist.github.com:4399b2351c59438db19a8ffb1f3fcdca.git hello-today\r\n$ cd hello-today\r\n$ npm it\r\n```\r\n\r\nThis uses an experimental loader which loads an `importmap.json` and falls back to the original filesystem lookup if it fails.  I am also pretty sure this very naive implementation is missing edge cases, but in these simple cases it appears to work.\r\n\r\nObviously for support in core we would not use a loader, but I think the rest would be similar. Open questions I have are:\r\n\r\n**Where would node find the `importmap.json`?**\r\n\r\nMy first idea is at `node_modules/importmap.json`.  I think this would be expected behavior from users if their package managers started writing this file.\r\n\r\n**How would users override the `importmap.json`?**\r\n\r\nFor this I think a reasonable approach would be a cli flag (`--importmap`) and a package.json (`\"importmap\": \"./importmap.json\"`) field.\r\n\r\n**Do we want to wait for browsers to standardize import maps?**\r\n\r\nhttps://github.com/nodejs/node/issues/49443\r\n\r\nI think that this is a very valid concern.  Is there a way to help push that forward?  The benefits are pretty large in node IMO, and it would superseded all the work currently being done on yarn pnp and npm 8.  If we let those go forward but then this spec lands it might be even worse for shifting the community.\r\n\r\nCould we release it as flagged \u0026 experimental until browsers standardize?  This would mean users could opt in, but as it changed we could follow along.\r\n\r\n---\r\n\r\nThoughts? Next steps?","author":{"url":"https://github.com/wesleytodd","@type":"Person","name":"wesleytodd"},"datePublished":"2020-01-24T04:20:15.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":129},"url":"https://github.com/49443/node/issues/49443"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:9881a5cf-d909-44a2-8f42-b1652f6ca7c7
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idAF52:3D1E26:11DA44F:17BB1FF:6A4C5EF3
html-safe-nonce7c88495bb3a33c6b49069fc74df212715bd806893746d3c96d22c51e759d5208
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRjUyOjNEMUUyNjoxMURBNDRGOjE3QkIxRkY6NkE0QzVFRjMiLCJ2aXNpdG9yX2lkIjoiNTAxNTA1NzU5NzYyMDU3NTk4NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac4050f4d4d0b97b36743f75d40869fcfbffa49d48a870af75683cbd9856fbe4bf
hovercard-subject-tagissue:1878156296
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/49443/issue_layout
twitter:imagehttps://opengraph.githubassets.com/e4a0551a0550f56724bd459eea2b498c0dbea8db06945e2c08412dbe0188dc00/nodejs/node/issues/49443
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/e4a0551a0550f56724bd459eea2b498c0dbea8db06945e2c08412dbe0188dc00/nodejs/node/issues/49443
og:image:altI was hoping to start the conversation around getting Import Map support into core. I figured starting here with a proposal was better than starting right off with a PR. What Are Import Maps This p...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamewesleytodd
hostnamegithub.com
expected-hostnamegithub.com
None3d11bb817438277de2a940854450e83a7d32b6aeb5014e9e6b00a6423900251c
turbo-cache-controlno-preview
go-importgithub.com/nodejs/node git https://github.com/nodejs/node.git
octolytics-dimension-user_id9950313
octolytics-dimension-user_loginnodejs
octolytics-dimension-repository_id27193779
octolytics-dimension-repository_nwonodejs/node
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id27193779
octolytics-dimension-repository_network_root_nwonodejs/node
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release14099438da5379150f15a2892474c7c7e6c0e55e
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/nodejs/node/issues/49443#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F49443
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F49443
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=nodejs%2Fnode
Reloadhttps://github.com/nodejs/node/issues/49443
Reloadhttps://github.com/nodejs/node/issues/49443
Reloadhttps://github.com/nodejs/node/issues/49443
Please reload this pagehttps://github.com/nodejs/node/issues/49443
nodejs https://github.com/nodejs
nodehttps://github.com/nodejs/node
Please reload this pagehttps://github.com/nodejs/node/issues/49443
Notifications https://github.com/login?return_to=%2Fnodejs%2Fnode
Fork 36k https://github.com/login?return_to=%2Fnodejs%2Fnode
Star 118k https://github.com/login?return_to=%2Fnodejs%2Fnode
Code https://github.com/nodejs/node
Issues 1.4k https://github.com/nodejs/node/issues
Pull requests 964 https://github.com/nodejs/node/pulls
Actions https://github.com/nodejs/node/actions
Projects https://github.com/nodejs/node/projects
Security and quality 0 https://github.com/nodejs/node/security
Insights https://github.com/nodejs/node/pulse
Code https://github.com/nodejs/node
Issues https://github.com/nodejs/node/issues
Pull requests https://github.com/nodejs/node/pulls
Actions https://github.com/nodejs/node/actions
Projects https://github.com/nodejs/node/projects
Security and quality https://github.com/nodejs/node/security
Insights https://github.com/nodejs/node/pulse
Support for Import Mapshttps://github.com/nodejs/node/issues/49443#top
esmIssues and PRs related to the ECMAScript Modules implementation.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22esm%22
feature requestIssues that request new features to be added to Node.js.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22feature%20request%22
never-staleMark issue so that it is never considered stalehttps://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22never-stale%22
https://github.com/wesleytodd
wesleytoddhttps://github.com/wesleytodd
on Jan 24, 2020https://github.com/nodejs/node/issues/49443#issue-1878156296
Import Maphttps://github.com/WICG/import-maps
https://github.com/WICG/import-mapshttps://github.com/WICG/import-maps
https://gist.github.com/wesleytodd/4399b2351c59438db19a8ffb1f3fcdcahttps://gist.github.com/wesleytodd/4399b2351c59438db19a8ffb1f3fcdca
#49443https://github.com/nodejs/node/issues/49443
esmIssues and PRs related to the ECMAScript Modules implementation.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22esm%22
feature requestIssues that request new features to be added to Node.js.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22feature%20request%22
never-staleMark issue so that it is never considered stalehttps://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22never-stale%22
Node.js feature requestshttps://github.com/orgs/nodejs/projects/4
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.