Skip to content

Commit

Permalink
Add note to Webpack docs about how to handle dynamic imports (#2800)
Browse files Browse the repository at this point in the history
* Add note to Webpack docs about how to handle dynamic imports

* Update Webpack.md
  • Loading branch information
SimenB authored and cpojer committed Feb 3, 2017
1 parent f94140c commit 91ef29d
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion docs/Webpack.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ thus requires ES modules to be transpiled to CommonJS modules. As such, if you
are using webpack 2, you most likely will want to configure Babel to transpile
ES modules to CommonJS modules only in the `test` environment.

```js
```json
// .babelrc
{
"presets": [
Expand All @@ -226,3 +226,23 @@ ES modules to CommonJS modules only in the `test` environment.
}
}
```

If you use dynamic imports (`import('some-file.js').then(module => ...)`), you
need to enable the `dynamic-import-node` plugin.

```json
// .babelrc
{
"presets": [
["es2015", {"modules": false}]
],

"plugins": ["syntax-dynamic-import"],

"env": {
"test": {
"plugins": ["dynamic-import-node"]
}
}
}
```

0 comments on commit 91ef29d

Please sign in to comment.