Sha256: bdf18d42d177b577756596d43e3e7e08007f1a4ae21ac33154989bd9cf84d168

Contents?: true

Size: 1.31 KB

Versions: 7

Compression:

Stored size: 1.31 KB

Contents

# ES6


## Babel

Webpacker ships with [babel](https://babeljs.io/) - a JavaScript compiler so
you can use next generation JavaScript, today. The Webpacker installer sets up a
standard `babel.config.js` file in your app root, which will work great in most cases
because of [@babel/preset-env](https://github.com/babel/babel/tree/master/packages/babel-preset-env).

Following ES6/7 features are supported out of the box:

* Async/await.
* Object Rest/Spread Properties.
* Exponentiation Operator.
* Dynamic import() - useful for route level code-splitting
* Class Fields and Static Properties.

We have also included [core-js](https://github.com/zloirock/core-js) to polyfill features in the
older browsers.

Don't forget to add these lines into your main entry point:

```js
import "core-js/stable";
import "regenerator-runtime/runtime";
```


## Module import vs require()

While you are free to use `require()` and `module.exports`, we encourage you
to use `import` and `export` instead since it reads and looks much better.

```js
import Button from 'react-bootstrap/lib/Button'

// or
import { Button } from 'react-bootstrap'

class Foo {
  // code...
}

export default Foo
import Foo from './foo'
```

You can also use named export and import

```js
export const foo = () => console.log('hello world')
import { foo } from './foo'
```

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/webpacker-4.0.7/docs/es6.md
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/webpacker-4.0.7/docs/es6.md
webpacker-4.0.7 docs/es6.md
webpacker-4.0.6 docs/es6.md
webpacker-4.0.5 docs/es6.md
webpacker-4.0.4 docs/es6.md
webpacker-4.0.3 docs/es6.md