const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: { main: './src/index.js' },
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'main.js'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
},
{
test: /\.sass$/,
use: ExtractTextPlugin.extract(
{
fallback: 'style-loader',
use: [
{
loader: 'css-loader',
sourceMap: true
},
{
loader: 'postcss-loader',
sourceMap: true
},
{
loader: 'sass-loader',
sourceMap: true
}
]}
)
}
]
},
plugins: [
new ExtractTextPlugin({filename: 'style.css'}),
new HtmlWebpackPlugin({
inject: false,
hash: true,
template: './src/index.html',
filename: 'index.html'
})
]
};