-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathwebpack.config.js
37 lines (36 loc) · 1.03 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
// webpack.config.js
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: './src/app.js', // Your entry point
output: {
filename: 'app.js',
path: path.resolve(__dirname, 'dist'), // Output directory
clean: true,
},
plugins: [
new HtmlWebpackPlugin({
template: './src/index.html', // Your HTML template
filename: 'index.html', // Output filename for HTML
}),
],
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'], // Ensures ES6+ code works in older browsers
},
},
},
],
},
devServer: {
static: path.join(__dirname, 'dist'), // Serve files from the 'dist' directory
compress: true,
port: 8080,
},
};