-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
43 lines (41 loc) · 1.76 KB
/
Copy pathwebpack.config.js
File metadata and controls
43 lines (41 loc) · 1.76 KB
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
// This file defines the build configuration for webpack
// The require statement is used to import the path module and the HtmlWebpackPlugin plugin
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
// The module.exports statement is used to export the configuration object so that webpack can use it
module.exports = {
// A list of entry points to build with their output file names
// A entry point is a file that webpack will start from to build the dependency graph
entry: {
'main.js': './src/main.js',
},
// The output configuration options tell webpack how to write the compiled files to disk
output: {
// The path to the directory where the output files will be placed
path: path.resolve(__dirname, 'dist'),
// The name of the output files ('[name]' is a placeholder for the entry point name)
filename: '[name]',
},
// The plugins configuration option is used to customize the webpack build process in a variety of ways
plugins: [
// The HtmlWebpackPlugin generates an HTML file in the output directory
new HtmlWebpackPlugin({
// The name of the generated HTML file
filename: 'index.html',
// The path to the template file to use as the base of the generated HTML file
template: 'src/index.html',
// The chunks option tells the plugin which entry points to include in the generated HTML file
chunks: ['main.js']
})
],
module: {
rules: [
{
test: /\.css$/i,
use: ["style-loader", "css-loader"],
},
],
},
// The mode configuration option is used to set the mode for the build process
mode: 'development',
};