If you’re running JavaScript on a server, how do you import a module? Traditionally, imports looked like this, with CommonJS:

const axios = require('axios');

But now they look like this with ECMAScript Modules:

import axios from 'axios';
// Or, less often, dynamically:
const axios = await import('axios');

However, there’s another layer of complexity: import specifiers.

2021: Node.js introduces the node: protocol

I think the first kind of specifier for a real runtime - and I’ll be specific about that because the Webpack bundler supported a tremendous variety of import styles before this - was Node.js, in …

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help