This repository has been archived by the owner on Jun 2, 2022. It is now read-only.
/
webpack.config.js
49 lines (48 loc) · 1.44 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const { join } = require('path');
const Sass = require('sass');
const StyleLintPlugin = require('stylelint-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const WebpackBar = require('webpackbar');
module.exports = {
mode: 'production',
entry: './assets/js/index.js',
output: { filename: 'bundle.js', path: join(__dirname, 'public/bundle') },
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: [{ loader: 'babel-loader', options: { cacheDirectory: true } }]
},
{
test: /\.(scss)$/,
exclude: /node_modules/,
use: [
{ loader: MiniCssExtractPlugin.loader },
{ loader: 'css-loader' },
{ loader: 'postcss-loader' },
{
loader: 'sass-loader',
options: { implementation: Sass }
}
]
},
{
test: /\.(ttf|eot|woff|woff2|svg)$/,
use: [{ loader: 'file-loader', options: { name: '[name].[ext]' } }]
}
]
},
plugins: [
new CleanWebpackPlugin(),
new MiniCssExtractPlugin({ filename: 'bundle.css' }),
new StyleLintPlugin(),
new WebpackBar({ profile: true, reporter: 'profile' })
],
optimization: {
minimizer: [new TerserPlugin({ parallel: true, extractComments: true })]
},
stats: 'errors-only'
};