generated from MussieTeka/webpack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
37 lines (35 loc) · 1.02 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
/*eslint-disable*/
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
mode: 'development',
entry: {
script: './src/script.js', // First entry point for the application
},
// devtool: 'inline-source-map',
devServer: {
static: './dist', // Serve static files from the 'dist' directory
},
plugins: [
new HtmlWebpackPlugin({
template: './src/index.html', // Use the index.html file as a template
}),
],
output: {
filename: '[name].bundle.js', // Use the entry point name for the bundle filename
path: path.resolve(__dirname, 'dist'), // Output to the 'dist' directory
clean: true, // Clean the output directory before building
},
module: {
rules: [
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'], // Process CSS files with 'style-loader' and 'css-loader'
},
{
test: /\.(png|svg|jpg|jpeg|gif)$/i,
type: 'asset/resource', // Process image files as assets
},
],
},
};