const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const PATHS = {
source: path.join(__dirname, './app'),
build: path.join(__dirname, './dist')
};
module.exports = {
devtool: 'source-map',
context: PATHS.source,
entry: PATHS.source + '/js/app.js',
output: {
path: PATHS.build,
filename: 'js/build.js'
},
devServer: {
contentBase: PATHS.build,
compress: true,
historyApiFallback: {
index: 'index.html',
hot: true
}
},
module: {
rules: [
{
test: /\.js$/,
exclude: [/node_modules/],
use: [
{
loader: 'babel-loader',
options: {
presets: ['es2015']
}
}
]
},
{
test: /\.(sass|scss)$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
'css-loader',
'sass-loader'
]
})
}
]
}
};