-
Notifications
You must be signed in to change notification settings - Fork 5
/
webpack.config.js
121 lines (115 loc) · 4.13 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
'use strict';
const NODE_ENV = process.env.NODE_ENV || 'development';
const webpack = require('webpack');
const WebpackShellPlugin = require('webpack-shell-plugin');
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const postcssLoader = {
loader: 'postcss-loader',
options: {
plugins: () => {
return [
require('cssnano'),
require('autoprefixer')
];
}
}
};
module.exports = {
context: path.join(__dirname, '/app/views'),
entry: {
about: './about/about.pack',
create: './quests/create/create.pack',
error: './error/error.pack',
forgotPassword: './account/forgotPassword/forgotPassword.pack.js',
getQuest: [
'./quest/get-quest.pack.js',
'./blocks/quest-info/quest-info.pack.js',
'./blocks/likes/likes.pack',
'./blocks/finished/finished.pack',
'./comments/comment/comment.pack',
'./blocks/quest-info/geolocation',
'./blocks/quest-info/popup',
'./blocks/quest-info/comments',
'./comments/comment/deleteComment'
],
updateComment: './comments/update/update.pack',
main: [
'./pages/main/main.pack',
'./blocks/mainContent/mainContent.pack',
'./blocks/mainContent/name/name.pack',
'./blocks/advantages/advantages.pack',
'./blocks/steps/steps.pack'
],
management: './account/management/management.pack.js',
questsList: [
'./quests/quests-list/quests-list.pack',
'./blocks/sortAndSearch/sortAndSearch.pack',
'./blocks/search/__input/search__input.pack',
'./blocks/search/__icon-loupe/search__icon-loupe.pack',
'./blocks/search/search.pack',
'./blocks/sort/sort.pack',
'./blocks/sort/sort-bar/sort-bar.pack',
'./blocks/sort/sort-bar/__sort-choice/sort-bar__sort-choice.pack',
'./blocks/sort/sort-bar/__icon-triangle/sort-bar__icon-triangle.pack',
'./blocks/sort/sort-list/sort-list.pack',
'./blocks/sort/sort-list/__option/sort-list__option.pack',
'./blocks/quests-set/quests-set.pack',
'./blocks/quests-set/quest/quest.pack',
'./blocks/quests-set/quest/__name/quest__name.pack',
'./blocks/quests-set/quest/__photo/quest__photo.pack',
'./blocks/quests-set/quest/__stats/quest__stats.pack',
'./blocks/places/places.pack.js'
],
registration: './account/registration/registration.pack.js',
siteInfrastructure: [
'./blocks/header/header.pack',
'./blocks/header/menu/menu.pack',
'./blocks/header/login/login.pack',
'./blocks/header/logo/logo.pack',
'./blocks/footer/footer.pack',
'./_layout.pack'
],
signIn: './account/signIn/signIn.pack.js',
sortJS: './blocks/sort/sort',
sortByJS: './quests/quests-list/sort-quests',
statistics: './statistics/statistics.pack',
update: './quests/update/update.pack'
},
output: {
path: path.join(__dirname, '/app/public'),
filename: '[name].bundle.js',
library: '[name]'
},
watch: NODE_ENV === 'development',
watchOptions: {
aggregateTimeout: 100
},
devtool: 'cheap-module-source-map',
module: {
rules: [
{
test: /\.styl$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader', postcssLoader, 'stylus-loader']
})
},
{
test: /\.(woff|woff2|eot|ttf)$/,
loader: 'url-loader?limit=100000'
}
]
},
plugins: [
new webpack.DefinePlugin({
NODE_ENV: JSON.stringify(NODE_ENV)
}),
new ExtractTextPlugin({
filename: '[name].bundle.css'
}),
new WebpackShellPlugin({
onBuildExit: ['npm run deploy:surge']
})
]
};