There are three kinds of module specifiers:
-
Absolute specifiers are full URLs that are used directly – for example:
'file:///opt/nodejs/config.mjs' 'https://unpkg.com/liltest@0.0.5/dist/liltest.js'
-
Relative specifiers are relative URLs that are resolved against the URL of the importing module – for example:
// URL of importing module const u = 'https://example.com/public/dir/a.js'; assert.equal( new URL('./b.js', u).toString(), 'https://example.com/public/dir/b.js' ); assert.equal( new URL('../c.mjs', u).toString(), 'https://example.com/public/c.mjs' ); assert.equal( new URL('../../tmp/d.js', u).toString(), 'https://example.com/tmp/d.js' );
-
Bare specifiers are paths (without protocol and domain) that start with neither slashes nor dots – for example:
'some-package' 'lodash/fp/add'