forked from hasgeek/funnel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
148 lines (145 loc) · 5.94 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
process.traceDeprecation = true;
const webpack = require('webpack');
const ESLintPlugin = require('eslint-webpack-plugin');
const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const { InjectManifest } = require('workbox-webpack-plugin');
const { WebpackManifestPlugin } = require('webpack-manifest-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const nodeEnv = process.env.NODE_ENV || 'production';
module.exports = {
resolve: {
fallback: {
fs: false,
path: require.resolve('path-browserify'),
},
},
devtool: 'source-map',
externals: {
jquery: 'jQuery',
},
entry: {
app: path.resolve(__dirname, 'funnel/assets/js/app.js'),
index: path.resolve(__dirname, 'funnel/assets/js/index.js'),
project_header: path.resolve(__dirname, 'funnel/assets/js/project_header.js'),
project: path.resolve(__dirname, 'funnel/assets/js/project.js'),
submissions: path.resolve(__dirname, 'funnel/assets/js/submissions.js'),
submission: path.resolve(__dirname, 'funnel/assets/js/submission.js'),
labels: path.resolve(__dirname, 'funnel/assets/js/labels.js'),
schedule_view: path.resolve(__dirname, 'funnel/assets/js/schedule_view.js'),
event: path.resolve(__dirname, 'funnel/assets/js/event.js'),
scan_badge: path.resolve(__dirname, 'funnel/assets/js/scan_badge.js'),
scan_contact: path.resolve(__dirname, 'funnel/assets/js/scan_contact.js'),
contact: path.resolve(__dirname, 'funnel/assets/js/contact.js'),
search: path.resolve(__dirname, 'funnel/assets/js/search.js'),
membership: path.resolve(__dirname, 'funnel/assets/js/membership.js'),
comments: path.resolve(__dirname, 'funnel/assets/js/comments.js'),
update: path.resolve(__dirname, 'funnel/assets/js/update.js'),
rsvp_list: path.resolve(__dirname, 'funnel/assets/js/rsvp_list.js'),
notification_list: path.resolve(__dirname, 'funnel/assets/js/notification_list.js'),
notification_settings: path.resolve(
__dirname,
'funnel/assets/js/notification_settings.js'
),
account_saved: path.resolve(__dirname, 'funnel/assets/js/account_saved.js'),
form: path.resolve(__dirname, 'funnel/assets/js/form.js'),
account_form: path.resolve(__dirname, 'funnel/assets/js/account_form.js'),
submission_form: path.resolve(__dirname, 'funnel/assets/js/submission_form.js'),
labels_form: path.resolve(__dirname, 'funnel/assets/js/labels_form.js'),
cfp_form: path.resolve(__dirname, 'funnel/assets/js/cfp_form.js'),
app_css: path.resolve(__dirname, 'funnel/assets/sass/app.scss'),
form_css: path.resolve(__dirname, 'funnel/assets/sass/form.scss'),
index_css: path.resolve(__dirname, 'funnel/assets/sass/pages/index.scss'),
profile_css: path.resolve(__dirname, 'funnel/assets/sass/pages/profile.scss'),
project_css: path.resolve(__dirname, 'funnel/assets/sass/pages/project.scss'),
submission_css: path.resolve(__dirname, 'funnel/assets/sass/pages/submission.scss'),
labels_css: path.resolve(__dirname, 'funnel/assets/sass/pages/labels.scss'),
schedule_css: path.resolve(__dirname, 'funnel/assets/sass/pages/schedule.scss'),
about_css: path.resolve(__dirname, 'funnel/assets/sass/pages/about.scss'),
login_form_css: path.resolve(__dirname, 'funnel/assets/sass/pages/login_form.scss'),
comments_css: path.resolve(__dirname, 'funnel/assets/sass/pages/comments.scss'),
scan_badge_css: path.resolve(__dirname, 'funnel/assets/sass/pages/scan_badge.scss'),
contacts_css: path.resolve(__dirname, 'funnel/assets/sass/pages/contacts.scss'),
submissions_css: path.resolve(
__dirname,
'funnel/assets/sass/pages/submissions.scss'
),
membership_css: path.resolve(__dirname, 'funnel/assets/sass/pages/membership.scss'),
account_css: path.resolve(__dirname, 'funnel/assets/sass/pages/account.scss'),
update_css: path.resolve(__dirname, 'funnel/assets/sass/pages/update.scss'),
imgee_modal_css: path.resolve(
__dirname,
'funnel/assets/sass/pages/imgee_modal.scss'
),
label_form_css: path.resolve(__dirname, 'funnel/assets/sass/pages/label_form.scss'),
submission_form_css: path.resolve(
__dirname,
'funnel/assets/sass/pages/submission_form.scss'
),
screens_css: path.resolve(__dirname, 'funnel/assets/sass/pages/screens.scss'),
event_css: path.resolve(__dirname, 'funnel/assets/sass/pages/event.scss'),
},
output: {
path: path.resolve(__dirname, 'funnel/static/build'),
publicPath: '/static/build/',
filename: 'js/[name].[chunkhash].js',
},
module: {
rules: [
{
enforce: 'pre',
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
options: {
plugins: ['@babel/plugin-syntax-dynamic-import'],
},
},
{
test: /\.scss$/,
exclude: /node_modules/,
use: [
{
loader: 'file-loader',
options: { outputPath: 'css/', name: '[name].[hash].css' },
},
'sass-loader',
],
},
],
},
plugins: [
new ESLintPlugin({
fix: true,
}),
new CopyWebpackPlugin({
patterns: [
{
from: 'node_modules/footable/css/fonts',
to: 'css/fonts',
},
{
from: 'node_modules/leaflet/dist/images',
to: 'css/images',
},
{
from: 'node_modules/prismjs/components/*.min.js',
to: 'js/prismjs/components/[name].js',
},
],
}),
new webpack.DefinePlugin({
'process.env': { NODE_ENV: JSON.stringify(nodeEnv) },
}),
new CleanWebpackPlugin({
root: path.join(__dirname, 'funnel/static'),
}),
new WebpackManifestPlugin({
fileName: path.join(__dirname, 'funnel/static/build/manifest.json'),
}),
new InjectManifest({
swSrc: path.resolve(__dirname, 'funnel/assets/service-worker-template.js'),
swDest: path.resolve(__dirname, 'funnel/static/build/js/service-worker.js'),
}),
],
};