JS - meaning of @ in import '@foo/bar'

我的未来我决定 提交于 2021-02-16 13:47:07

问题


While reading this article earlier, I came across the following line of code:

import { run } from '@cycle/core';

Which led me to the following questions:

  • What is the significance of the @ symbol, if any?
  • Is there a difference between import 'foo/bar' and import '@foo/bar'?

Is it a way to resolve a particular type of module?

I'm relatively new to ES6, although the import syntax seems pretty straightforward to me - except, in this case, for the cryptic presence of the @ symbol.

I tried googling but couldn't find any information on Stack Overflow, MDN or elsewhere.


回答1:


Right from the Getting Started docs:

Packages of the type @org/package are npm scoped packages, supported if your npm installation is version 2.11 or higher. Check your npm version with npm --version and upgrade in order to install Cycle.js.

In case you are not dealing with a DOM-interfacing web application, you can omit @cycle/dom when installing.



来源:https://stackoverflow.com/questions/33628522/js-meaning-of-in-import-foo-bar

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