hubl/webpack.config.js
2019-11-03 17:22:37 +01:00

57 lines
1.2 KiB
JavaScript

const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const config = {
entry: {
app: './src/scripts/index.js'
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: "[name].bundle.js",
},
plugins: [
new HtmlWebpackPlugin({
template: './src/index.pug'
}),
new MiniCssExtractPlugin({
filename: "style.css"
})
],
module: {
rules: [
{
test: /\.pug$/,
use: "pug-loader"
},
{
test: /\.js$/,
exclude: /node_modules/,
use: "babel-loader"
},
{
test: /\.scss$/,
use: [
MiniCssExtractPlugin.loader,
{ loader: 'css-loader', options: { url: false, sourceMap: true } },
{ loader: 'sass-loader', options: { sourceMap: true } }
]
},
{
test: /\.(gif|png|jpe?g|svg)$/i,
use: 'file-loader'
},
{
test: /\.(eot|ttf|woff|woff2)$/,
loader: 'file-loader',
}
]
}
};
module.exports = (env, argv) => {
if (argv.mode === 'development') {}
if (argv.mode === 'production') {}
return config;
}