0

I was reading this article about Javascript module: https://javascript.info/modules-intro#no-bare-modules-allowed

It says

In the browser, import must get either a relative or absolute URL. Modules without any path are called “bare” modules. Such modules are not allowed in import.

However, in a lot of documentations that I see, import is being used with "bare" module, this one for example:

https://sheet2api.com/google-sheet-javascript/

What did I miss?

shenkwen
  • 3,536
  • 5
  • 45
  • 85

1 Answers1

1

The example you posted is a Node.js example, it installs with the npm package manager

The documentation said "Certain environments, like Node.js or bundle tools allow bare modules" which is true

  • I thought so. But why these documentations never care to mention that it is for Node.js? Is Node.js so widely used that they don't think it is necessary to mention it? – shenkwen Aug 08 '20 at 18:17