-
Notifications
You must be signed in to change notification settings - Fork 74
/
Copy pathwebpack.common.js
56 lines (54 loc) · 1.33 KB
/
webpack.common.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
50
51
52
53
54
55
56
const webpack = require("webpack");
const path = require("path");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const pathMainJs = require.resolve("./src/app.js");
const pathIndexCss = require.resolve("./src/css/style.css");
const pathIndexHtml = require.resolve("./src/index.html");
const pathIndexFavicon = require.resolve("./src/img/favicon.ico");
module.exports = {
entry: [
'@babel/polyfill',
pathMainJs,
pathIndexHtml,
pathIndexCss,
pathIndexFavicon
],
plugins: [
new CleanWebpackPlugin(),
],
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'app.js',
publicPath: '/',
},
module: {
rules: [
{
test: /\.js$/,
use: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.css$/i,
type: 'asset/resource',
generator: {
filename: 'css/[name][ext][query]'
}
},
{
test: /\.html$/i,
type: 'asset/resource',
generator: {
filename: '[name][ext][query]'
}
},
{
test: /\.(png|svg|jpg|jpeg|gif|ico)$/i,
type: 'asset/resource',
generator: {
filename: 'img/[name][ext][query]'
}
},
]
}
};