-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.js
68 lines (67 loc) · 1.48 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
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
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
target: 'web',
entry: {
index: path.join(__dirname, 'src', 'pages', 'index.jsx'),
css: path.join(__dirname, 'src', 'js', 'styles.js'),
},
output: {
path: path.join(__dirname, 'build'),
filename: '[name].bundle.js',
charset: true,
},
devServer: {
hot: true,
liveReload: true,
host: '0.0.0.0',
port: 8080,
static: {
directory: path.join(__dirname, 'dist'),
},
},
plugins: [
new HtmlWebpackPlugin({
filename: 'index.html',
chunks: ['index', 'css'],
template: path.join(__dirname, 'src', 'html', 'index.html'),
}),
],
module: {
rules: [
{
test: /\.(js|jsx)$/i,
include: [
path.resolve(__dirname, 'src'),
path.resolve(__dirname, 'node_modules/marked'),
],
exclude: '/node_modules/',
use: {
loader: 'babel-loader',
},
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
},
{
test: /\.s[ac]ss$/i,
use: ['style-loader', 'css-loader', 'sass-loader'],
},
{
test: /\.(ya?ml)$/i,
use: {
loader: 'js-yaml-loader',
},
},
{
test: /\.(jpe?g|png|gif|svg|mp4)$/i,
loader: 'file-loader',
options: {
name: 'assets/[name].[ext]',
esModule: false,
},
},
],
},
};