How does webpack resolve imports from node_modules?

吃可爱长大的小学妹 提交于 2019-12-03 22:31:04
Grgur

Webpack loops over resolvers to find the file you requested. It goes over resolve templates to figure out the exact path.

If you try to import a module that doesn't exist you'll see the error trace outlining all the paths it tried to use to find the file but failed.

Resolvers are a powerful configuration tool that could help you develop better code. I really appreciate that resolvers allow me to drop relative paths and use more developer-friendly ES6 imports.

I hope that helps.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!