Skip to content

Commit

Permalink
Gbrassey update docs (#331) (#197)
Browse files Browse the repository at this point in the history
* updates docs re: transform-runtime

* moves polyfill message to follow transform-runtime

* Correct link to regenerator
  • Loading branch information
danez committed Nov 16, 2016
1 parent 13c34a5 commit d2f236d
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,30 +123,9 @@ loaders: [
]
```

### The node API for `babel` has been moved to `babel-core`.

If you receive this message it means that you have the npm package `babel` installed and use the short notation of the loader in the webpack config (which is not valid anymore as of webpack 2.x):
```js
{
test: /\.js$/,
loader: 'babel',
}
```

Webpack then tries to load the `babel` package instead of the `babel-loader`.

To fix this you should uninstall the npm package `babel` as it is deprecated in babel v6. (instead install `babel-cli` or `babel-core`)
In the case one of your dependencies is installing `babel` and you cannot uninstall it yourself, use the complete name of the loader in the webpack config:
```js
{
test: /\.js$/,
loader: 'babel-loader',
}
```

### custom polyfills (e.g. Promise library)
#### **NOTE:** transform-runtime & custom polyfills (e.g. Promise library)

Since Babel includes a polyfill that includes a custom [regenerator runtime](https://github.com/facebook/regenerator/blob/master/runtime.js) and [core.js](https://github.com/zloirock/core-js), the following usual shimming method using `webpack.ProvidePlugin` will not work:
Since [babel-plugin-transform-runtime](https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-runtime) includes a polyfill that includes a custom [regenerator runtime](https://github.com/facebook/regenerator/blob/master/packages/regenerator-runtime/runtime.js) and [core.js](https://github.com/zloirock/core-js), the following usual shimming method using `webpack.ProvidePlugin` will not work:

```javascript
// ...
Expand Down Expand Up @@ -190,4 +169,25 @@ require('babel-runtime/core-js/promise').default = require('bluebird');
require('./app');
```

### The node API for `babel` has been moved to `babel-core`.

If you receive this message it means that you have the npm package `babel` installed and use the short notation of the loader in the webpack config (which is not valid anymore as of webpack 2.x):
```js
{
test: /\.js$/,
loader: 'babel',
}
```

Webpack then tries to load the `babel` package instead of the `babel-loader`.

To fix this you should uninstall the npm package `babel` as it is deprecated in babel v6. (instead install `babel-cli` or `babel-core`)
In the case one of your dependencies is installing `babel` and you cannot uninstall it yourself, use the complete name of the loader in the webpack config:
```js
{
test: /\.js$/,
loader: 'babel-loader',
}
```

## [License](http://couto.mit-license.org/)

0 comments on commit d2f236d

Please sign in to comment.