简体   繁体   English

本机模块分辨率

[英]Native module resolution

If I import a module using the native syntax like so:如果我使用本机语法导入一个模块,如下所示:

import React from 'react'

How does the JavaScript runtime know where to look for the file containing the "react" module, given that no absolute of relative path is specified?如果没有指定绝对相对路径,JavaScript 运行时如何知道在哪里查找包含“react”模块的文件?

Babel transpiles import statements to require . Babel 将 import 语句转换为require

Thesedocs describe how require works.这些文档描述了require是如何工作的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM