Skip to content

Commit e849c15

Browse files
kcoltonskipjack
authored andcommitted
docs(guides): link required babel plugin for async (#1769)
Links to the Babel plugin required to make `await import` work. There is a lot of outdated solutions, so referencing the current most up to date. Rephrased the paragraph slightly as well.
1 parent 2ad6a8b commit e849c15

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/content/guides/code-splitting.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ contributors:
2121
- rouzbeh84
2222
- shaodahong
2323
- sudarsangp
24+
- kcolton
2425
---
2526

2627
T> This guide extends the examples provided in [Getting Started](/guides/getting-started) and [Output Management](/guides/output-management). Please make sure you are at least familiar with the examples provided in them.
@@ -263,7 +264,7 @@ lodash.bundle.js 541 kB 0 [emitted] [big] lodash
263264
[3] (webpack)/buildin/module.js 517 bytes {0} [built]
264265
```
265266

266-
If you've enabled [`async` functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function) via a pre-processor like babel, note that you can simplify the code as `import()` statements just return promises:
267+
As `import()` returns a promise, it can be used with [`async` functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function). However, this requires using a pre-processor like Babel and the [Syntax Dynamic Import Babel Plugin](https://babeljs.io/docs/plugins/syntax-dynamic-import/#installation). Here's how it would simplify the code:
267268

268269
__src/index.js__
269270

0 commit comments

Comments
 (0)