1var path = require('path');
2var ExtractTextPlugin = require('extract-text-webpack-plugin');
3var webpack = require('webpack');
4var AssetsPlugin = require('assets-webpack-plugin');
5
6module.exports = {
7 entry: {
8 app: './js/main.js'
9 },
10 module: {
11 rules: [
12 {
13 test: /\.js$/,
14 exclude: /node_modules/,
15 use: {
16 loader: 'babel-loader',
17 options: {
18 presets: ['env']
19 }
20 }
21 },
22 {
23 test: /\.css$/,
24 use: ExtractTextPlugin.extract({
25 fallback: 'style-loader',
26 use: 'css-loader?importLoaders=1!postcss-loader'
27 })
28 }
29 ]
30 },
31
32 output: {
33 path: path.join(__dirname, './../static/dist'),
34 filename: 'js/[name].[chunkhash].js'
35 },
36
37 resolve: {
38 modules: [path.resolve(__dirname, 'src'), 'node_modules']
39 },
40
41 plugins: [
42 new AssetsPlugin({
43 filename: 'webpack_assets.json',
44 path: path.join(__dirname, '../data'),
45 prettyPrint: true
46 }),
47 new ExtractTextPlugin({
48 filename: getPath => {
49 return getPath('css/[name].[contenthash].css');
50 },
51 allChunks: true
52 })
53 ],
54 watchOptions: {
55 watch: true
56 }
57};