Total Complexity | 0 |
Complexity/F | 0 |
Lines of Code | 54 |
Function Count | 0 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 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 | }; |