-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
102 lines (100 loc) · 3.01 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
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
const path = require('path');
const webpack = require('webpack');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const autoprefixer = require('autoprefixer');
module.exports = {
entry: {
bundle: "./src/main.js",
qa_bundle: "./src/qa/index.js",
},
output: {
path: path.resolve(__dirname, "public"),
filename: "[name].js",
},
module: {
rules: [
{
test: /\.html$/,
loader: 'underscore-template-loader',
},{
test: /\.(png|jpg|svg)$/,
loaders: [
'file-loader',
{
loader: 'image-webpack-loader',
query:{
progressive: true,
gifsicle: {
interlaced: false,
},
optipng: {
optimizationLevel: 7,
},
mozjpg: {
quality: '65-90',
speed: 1,
},
pngquant: {
quality: '65-90',
speed: 1,
},
}
},
]
},{
test: /\.js$/,
exclude: /(node_module)|(bower_components)/,
loader: 'babel-loader',
query: {
presets: ['ES2015', 'stage-0'],
plugins: [],
}
},{
test: /\.scss$/,
use: [
{loader: "style-loader"},
{loader: "css-loader"},
{loader: "sass-loader"},
{loader: "postcss-loader"},
]
}
]
},
devServer: {
historyApiFallback: true,
inline: true,
hot: true,
compress: true,
port: 8080,
},
plugins: [
new CleanWebpackPlugin(['public']),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
"window.jQuery": "jquery"
}),
new HtmlWebpackPlugin({
title: '2017 梅竹黑客松',
template: 'src/template.html',
chunks: ['bundle'],
favicon: 'src/Img/1.png',
}),
new HtmlWebpackPlugin({
title: '2017 梅竹黑客松',
template: 'src/qa/qa_template.html',
chunks: ['qa_bundle'],
filename: 'qa.html',
favicon: 'src/Img/1.png',
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.LoaderOptionsPlugin({
options: {
postcss:[
autoprefixer(),
]
}
})
]
}