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
50
|
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
entry: './web/src/js/main.js',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'web', 'static', 'assets', 'js'),
},
mode: 'production',
module: {
rules: [
{
test: /\.(scss)$/,
use: [
MiniCssExtractPlugin.loader, // Extract CSS to a separate file
'css-loader',
'postcss-loader',
{
loader: 'sass-loader',
options: {
sourceMap: true, // Enable source maps for debugging
},
},
],
},
{
test: /\.(woff2?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: '../fonts/', // Adjust the output path as needed
},
},
],
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: './web/src/index.html', // Provide your HTML template file
}),
new MiniCssExtractPlugin({
filename: '../css/styles.css', // Output path for CSS
}),
],
};
|