# webpack-es6-config

> A simple tools to create ES6 specific Webpack config

Latest version **1.0.0** (published 2016-01-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install webpack-es6-config
pnpm add webpack-es6-config
yarn add webpack-es6-config
bun add webpack-es6-config
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2016-01-27 |
| First published | 2016-01-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Mathieu ANCELIN |
| Maintainers | mathieuancelin |

## Links

- npm: https://www.npmjs.com/package/webpack-es6-config
- npm.io page: https://npm.io/package/webpack-es6-config

## Recent versions

- 1.0.0 (latest) — 2016-01-27

## README

# webpack-es6-config

A simple tool to create ES6 enabled webpack config

```
npm install --save-dev webpack-es6-config
```

You *must have* `webpack` and `babel-loader` already installed.


Then in your `webpack.config.js` file, add the following

```javascript
var config = require('webpack-es6-config');

module.exports = config({
  filename: 'my-cool-app.js',
  libraryName: 'MyCoolApp',
  entry: './src/main.js',
});
```

it will be equivalent to

```javascript
var webpack = require('webpack');

var plugins = [
  new webpack.optimize.DedupePlugin(),
  new webpack.optimize.OccurenceOrderPlugin(),
  new webpack.DefinePlugin({
    '__DEV__': process.env.NODE_ENV === 'production' ? false : true,
    'process.env': {
      NODE_ENV: JSON.stringify(process.env.NODE_ENV || 'dev')
    }
  })
];
if (process.env.NODE_ENV === 'production') {
  plugins.push(new webpack.optimize.UglifyJsPlugin({
    compressor: {
      screw_ie8: true,
      warnings: false
    }
  }));
} else {
  plugins.push(new webpack.HotModuleReplacementPlugin());
  plugins.push(new webpack.NoErrorsPlugin());
}

module.exports = {
  output: {
    path: './dist/',
    publicPath: '/dist/',
    filename: 'my-cool-app.js',
    library: 'MyCoolApp',
    libraryTarget: 'umd'
  },
  devServer: {
    contentBase: './public/',
  },
  entry: [
    './src/main.js'
  ],
  resolve: {
    extensions: ['', '.js', '.jsx', 'es6']
  },
  module: {
    loaders: [
      {
        test: /\.js|\.jsx|\.es6$/,
        exclude: /node_modules/,
        loader: 'babel-loader'
      }
    ]
  },
  plugins: plugins
};
```
possible configs are :

```javascript
{
  filename: 'app.js', // name of the dist file
  libraryName: 'App', // global name of the library
  entry: './src/index.js', // entry point (can be an array)
  loaders: [], // loaders other than babel-loader
  extensions: [], // file extension to load with babel-loader
  globalPlugins: [], // plugins to add globally
  devPlugins: [], // plugins to add only in dev mode
  prodPlugins: [] // plugins to add only in prod mode
}
```

---
_Source: https://npm.io/package/webpack-es6-config · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
