正在加载视频...

视频加载失败

🔥 JavaScript import maps are now in all the browsers! Here is how they work with ES modules.

129,814 次观看 • 3 年前 •via X (Twitter)

10 条评论

Wes Bos 的头像
Wes Bos3 年前

Node.js also supports something very similar to import maps. It must be prefixed with '#' and can be used as a wildcard. There is talk + experiments around supporting the full spec via Node.js Policies Deno supports the importmap spec

Wes Bos 的头像
Wes Bos3 年前

TypeScript has `path` where you can do something very similar as well, but needs some work from your bundler to work. Maybe once we see Node.js pick up import maps, the TS paths can be replaced with import maps. Web standards?

Jake 的头像
Jake3 年前

I wonder how the dependency conflicts would be solved in this context 🤔. Or is this just another way of importing a library like a regular script src tag?

Wes Bos 的头像
Wes Bos3 年前

It only resolves them 1 level deep, so your dependencies would have to resolve themselves or have their own import map. So i'd expect the same issues that we have with npm

Mihemed Şahîn 的头像
Mihemed Şahîn3 年前

🔥 So excited to try it.

Joaquin Beceiro 的头像
Joaquin Beceiro3 年前

Excellent for testing avoiding installing modules for a simple test application! Thank you!!

Url Sweatshirt 的头像
Url Sweatshirt3 年前

Was not prepared for the safari dev tools jump scare at the end

Joshua Koudys 的头像
Joshua Koudys3 年前

Good for those of us who don't need to transpile any JSX.

k644 的头像
k6443 年前

Cool!

35961 的头像
359613 年前

#JavaScript Is boxing about putting two people in a box? In JavaScript, Boxing is the automatic conversion of strings to objects when methods are called on them.

相关视频