Homepage/webpack.config.js

65 lines
1.7 KiB
JavaScript
Raw Normal View History

2019-04-08 08:38:15 +00:00
const path = require('path')
const BrowserSyncPlugin = require('browser-sync-webpack-plugin')
const MiniCssExtractPlugin = require("mini-css-extract-plugin")
module.exports = {
context: path.resolve(__dirname, 'src'),
entry: {
index: './index.js',
},
module: {
rules: [
{
test: /\.(eot|jpg|png|svg|ttf|woff2?)$/,
loader: 'file-loader',
options: {
name: '[path][name].[ext]',
},
},
{
test: /\.(html)$/,
use: [
'file-loader?name=[name].[ext]',
'extract-loader',
{
loader: 'html-loader',
options: {
minimize: true,
removeComments: false,
collapseWhitespace: false
},
},
],
},
{
test: /\.(c|sa|sc)ss$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'resolve-url-loader',
"sass-loader",
],
},
],
},
output: {
filename: 'index.bundle.js',
path: path.resolve(__dirname, 'dist'),
},
plugins: [
new BrowserSyncPlugin({
host: 'localhost',
port: 3000,
server: { baseDir: ['dist'] },
}),
new MiniCssExtractPlugin({
chunkFilename: '[id].css',
filename: '[name].css',
}),
],
}