-
Notifications
You must be signed in to change notification settings - Fork 20
/
webpack.dev.js
110 lines (104 loc) · 2.44 KB
/
webpack.dev.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const GitRevisionPlugin = require('git-revision-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const gitRevisionPlugin = new GitRevisionPlugin();
const version = {
VERSION: gitRevisionPlugin.version(),
COMMITHASH: gitRevisionPlugin.commithash(),
BRANCH: gitRevisionPlugin.branch(),
};
module.exports = {
mode: 'development',
devtool: 'eval-cheap-module-source-map',
entry: {
main: './src/js/main.js',
agenda: './src/js/main-agenda.js',
},
devServer: {
port: 8085,
contentBase: path.join(__dirname, 'dist'),
historyApiFallback: {
rewrites: [{ from: /^\/workshop$/, to: '/workshop.html' }],
},
},
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules)/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
},
},
},
{
test: /\.scss$/,
use: [
{
loader: 'style-loader',
options: {
sourceMap: true,
},
},
{
loader: 'css-loader',
options: {
sourceMap: true,
},
},
{
loader: 'sass-loader',
options: {
sourceMap: true,
},
},
],
},
{
test: /\.(png|jpg|jpeg|gif|svg|pdf)$/,
use: [
{
loader: 'file-loader',
options: {
name: '[path][name].[ext]',
limit: 8192,
},
},
],
},
{
test: /\.html$/,
loader: 'html-loader',
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: './src/index.html',
chunks: ['main'],
}),
new HtmlWebpackPlugin({
filename: 'regulamin.html',
template: './src/regulamin.html',
chunks: ['main'],
}),
new HtmlWebpackPlugin({
filename: 'agenda.html',
template: './src/agenda.html',
chunks: ['agenda'],
}),
new HtmlWebpackPlugin({
filename: 'workshop.html',
template: './src/workshop.html',
// chunks: ['workshop'],
}),
new CopyWebpackPlugin([{ from: 'src/pdf', to: 'pdf' }]),
new webpack.DefinePlugin({
VERSION: JSON.stringify(version),
}),
],
};