Completed
Push — master ( 2008a4...6fb17f )
by Michal
03:39
created

examples/webpack/webpack.config.babel.js   A

Complexity

Total Complexity 0
Complexity/F 0

Size

Lines of Code 54
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
wmc 0
c 1
b 0
f 0
nc 1
mnd 0
bc 0
fnc 0
dl 0
loc 54
rs 10
bpm 0
cpm 0
noi 0
1
import ExtractTextPlugin from 'extract-text-webpack-plugin';
2
import ContentHashPlugin from 'webpack-content-hash';
3
import ManifestPlugin from 'webpack-manifest-plugin';
4
import CleanWebpackPlugin from 'clean-webpack-plugin';
5
6
// Config
7
const publicDir = 'www';
8
const buildDir = 'dist';
9
const manifest = `${publicDir}/manifest.json`;
10
11
module.exports = {
12
  entry: {
13
    "app": ['./app/scripts/index.js', './app/styles/main.scss'],
14
  },
15
  output: {
16
    filename: `${publicDir}/${buildDir}/[name].[content:8].js`
17
  },
18
  module: {
19
    rules: [
20
      // JS
21
      {
22
        test: /\.js$/,
23
        exclude: /(node_modules|bower_components)/,
24
        use: {
25
          loader: 'babel-loader',
26
          options: {
27
            presets: ['env']
28
          }
29
        }
30
      },
31
      // SASS
32
      {
33
        test: /\.scss$/,
34
        loader: ExtractTextPlugin.extract(['css-loader', 'sass-loader'])
35
      }
36
    ]
37
  },
38
  plugins: [
39
    new ExtractTextPlugin({
40
      filename: `${publicDir}/${buildDir}/[name].[content:8].css`,
41
      allChunks: true,
42
    }),
43
    new ContentHashPlugin(),
44
    new ManifestPlugin({
45
      fileName: manifest,
46
    }),
47
    new CleanWebpackPlugin(
48
      [`${publicDir}/${buildDir}`, manifest],
49
      {
50
        verbose: false,
51
        watch: true,
52
      }),
53
  ]
54
};