-
Notifications
You must be signed in to change notification settings - Fork 53
/
webpack.config.mjs
167 lines (164 loc) · 6.77 KB
/
webpack.config.mjs
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
process.traceDeprecation = true;
import { createRequire } from 'node:module';
import webpack from 'webpack';
import ESLintPlugin from 'eslint-webpack-plugin';
import path from 'path';
import { InjectManifest } from 'workbox-webpack-plugin';
import { WebpackManifestPlugin } from 'webpack-manifest-plugin';
import CopyWebpackPlugin from 'copy-webpack-plugin';
import { fileURLToPath } from 'url';
const require = createRequire(import.meta.url);
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const nodeEnv = process.env.NODE_ENV || 'production';
export default {
resolve: {
fallback: {
fs: false,
path: require.resolve('path-browserify'),
},
},
cache: {
type: 'filesystem',
cacheDirectory: path.resolve(__dirname, '.webpack_cache'),
},
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'),
profile: path.resolve(__dirname, 'funnel/assets/js/profile.js'),
profile_calendar: path.resolve(__dirname, 'funnel/assets/js/profile_calendar.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'),
autosave_form: path.resolve(__dirname, 'funnel/assets/js/autosave_form.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'),
rsvp_form_modal: path.resolve(__dirname, 'funnel/assets/js/rsvp_form_modal.js'),
shortlink_form: path.resolve(__dirname, 'funnel/assets/js/shortlink_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'),
profile_calendar_css: path.resolve(
__dirname,
'funnel/assets/sass/pages/profile_calendar.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',
compareBeforeEmit: true,
},
module: {
rules: [
{
enforce: 'pre',
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
options: {
plugins: ['@babel/plugin-syntax-dynamic-import'],
cacheCompression: false,
cacheDirectory: true,
},
},
{
test: /\.scss$/,
exclude: /node_modules/,
use: [
{
loader: 'file-loader',
options: { outputPath: 'css/', name: '[name].[hash].css' },
},
'sass-loader',
],
},
],
},
plugins: [
new ESLintPlugin({
fix: true,
cache: 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 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'),
exclude: [/prismjs/, /\.map$/, /\.LICENSE\.txt$/],
}),
],
};