-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
How do I use my own import map while vendoring? #14576
Comments
It would be nice if it did this, but also walked the input import map to still vendor remote modules specified in the input import map. Though the entries of the input import map remain unchanged, though still merged with the generated import map. This means that if the input import map just so happened to specify every remote module it could, then the final generated import map would look the same as the source one. |
Edit: See followup |
I might have spoke too soon. I have this import map at {
"imports": {
"oak": "https://deno.land/x/[email protected]/mod.ts",
"react": "https://esm.sh/react@18",
"react-dom/server": "https://esm.sh/react-dom@18/server"
}
}
and {
"imports": {
"https://cdn.esm.sh/": "./cdn.esm.sh/",
"https://deno.land/": "./deno.land/",
"https://esm.sh/": "./esm.sh/",
"https://raw.githubusercontent.com/": "./raw.githubusercontent.com/"
},
"scopes": {
"./cdn.esm.sh/": {
"/v78/[email protected]/deno/react.js": "./cdn.esm.sh/v78/[email protected]/deno/react.js"
},
"./deno.land/": {
"oak": "./deno.land/x/[email protected]/mod.ts"
},
"./esm.sh/": {
"react": "./esm.sh/[email protected]",
"react-dom/server": "./esm.sh/react-dom@18/server.js"
}
}
}
Then when I run: deno run --allow-net --allow-read --import-map ./vendor/import_map.json --cached-only main.ts I get:
|
Ok, from the previous example, I would expect the generated import_map.json to look like this, which works: {
"imports": {
"oak": "https://deno.land/x/[email protected]/mod.ts",
"react": "https://esm.sh/react@18",
"react-dom/server": "https://esm.sh/react-dom@18/server",
"https://cdn.esm.sh/": "./cdn.esm.sh/",
"https://deno.land/": "./deno.land/",
"https://esm.sh/": "./esm.sh/",
"https://raw.githubusercontent.com/": "./raw.githubusercontent.com/"
},
"scopes": {
"./cdn.esm.sh/": {
"/v78/[email protected]/deno/react.js": "./cdn.esm.sh/v78/[email protected]/deno/react.js"
}
}
} This feels like it could be a pretty straight forward transformation to be honest. It just keeps the existing mappings from the source input map, and resolves and adds to it to keep it local, as if the value of those mappings were what are actually used in source. |
Found #13697, so this feels like a dupe |
Hmm, seems my last throught is broken with |
still it's close, as I think it might just need to walk the vendor generated map to get a the value starting with the origin. |
I ended up writing this for now: |
This is essentially #13697. Follow there for updates. |
As far as I can tell, there's only one import map allowed as input in every command.
Would if you could pass
--import-map
todeno vendor
, so that the generated import map output is merged the one specified as input?The text was updated successfully, but these errors were encountered: