-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
74 lines (68 loc) · 1.35 KB
/
webpack.config.js
File metadata and controls
74 lines (68 loc) · 1.35 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
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
const path = require('path');
const htmlWebpackPlugin = require('html-webpack-plugin');
const cleanWebpackPlugin = require('clean-webpack-plugin');
module.exports = {
entry: './src/app.js',
output: {
filename: 'main.js',
path: path.resolve(__dirname,'dist/')
},
plugins: [
new cleanWebpackPlugin(['dist']),
new htmlWebpackPlugin({
filename: 'index.html',
template: 'src/index.html'
}),
new htmlWebpackPlugin({
filename: 'activity.html',
template: 'src/activity.html'
})
],
module: {
rules: [
{
test: /\.js$/,
use: {
loader: 'babel-loader',
options: {
presets: ['es2015']
}
},
exclude: [
path.resolve(__dirname,'node_modules')
]
},
{
test: /\.scss$/,
use: ['style-loader','css-loader','sass-loader']
},
{
test: /\.(jpg|png|gif|jpeg)$/,
use: [{
loader: 'url-loader',
options: {
limit: 10000,
name: 'img/[name]_[hash:8].[ext]'
}
}]
},
{
test: /\.html$/,
use: ['html-withimg-loader']
},
{
test: /\.(woff|eot|ttf|svg)$/,
use: {
loader: 'file-loader',
options: {
name: 'fonts/[name]_[hash:8].[ext]'
}
}
}
]
},
devServer: {
open: true,
port: 3000
}
}