Skip to content

Commit 8e251ab

Browse files
committed
explanations
1 parent 4dc4272 commit 8e251ab

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

1-js/13-modules/01-modules-intro/article.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -301,14 +301,14 @@ There are two notable differences of external module scripts:
301301
302302
That ensures better security by default.
303303
304-
### No bare modules allowed
304+
### No "bare" modules allowed
305305
306-
In the browser, in scripts (not in HTML), `import` must get either a relative or absolute URL. So-called "bare" modules, without a path, are not allowed.
306+
In the browser, in scripts (not in HTML), `import` must get either a relative or absolute URL. Modules without any path are called "bare" modules. Such modules are not allowed in `import`.
307307
308308
For instance, this `import` is invalid:
309309
```js
310310
import {sayHi} from 'sayHi'; // Error, "bare" module
311-
// must be './sayHi.js' or wherever the module is
311+
// the module must have a path, e.g. './sayHi.js' or wherever the module is
312312
```
313313
314314
Certain environments, like Node.js or bundle tools allow bare modules, as they have own ways for finding modules and hooks to fine-tune them. But browsers do not support bare modules yet.
@@ -328,7 +328,7 @@ Old browsers do not understand `type="module"`. Scripts of the unknown type are
328328
</script>
329329
```
330330
331-
If we use bundle tools, then as modules are bundled together, their `import/export` statements are replaced by special bundler calls, so the resulting build does not require `type="module"`, and we can put it into a regular script:
331+
If we use bundle tools, then as scripts are bundled together into a single file (or few files), `import/export` statements inside those scripts are replaced by special bundler functions. So the resulting "bundled" script does not contain any `import/export`, it doesn't require `type="module"`, and we can put it into a regular script:
332332
333333
```html
334334
<!-- Assuming we got bundle.js from a tool like Webpack -->

0 commit comments

Comments
 (0)