shenkwen
shenkwen

Reputation: 3880

Javascript import: "no bare module allowed"?

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?

Upvotes: 2

Views: 1633

Answers (1)

Kevin Morey
Kevin Morey

Reputation: 46

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

Upvotes: 1

Related Questions