forked from phpmyadmin/phpmyadmin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.cjs
More file actions
222 lines (219 loc) · 14.1 KB
/
webpack.config.cjs
File metadata and controls
222 lines (219 loc) · 14.1 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
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
const path = require('path');
const autoprefixer = require('autoprefixer');
const CopyPlugin = require('copy-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const RtlCssPlugin = require('rtlcss-webpack-plugin');
const rootPath = path.resolve(__dirname, '');
const publicPath = path.resolve(__dirname, 'public');
const typeScriptErrorsToIgnore = [
5096, // TS5096: Option 'allowImportingTsExtensions' can only be used when either 'noEmit' or 'emitDeclarationOnly' is set.
];
module.exports = [
{
mode: 'none',
devtool: 'source-map',
entry: {
'codemirror/addon/lint/sql-lint': rootPath + '/resources/js/codemirror/addon/lint/sql-lint.ts',
'console': { import: rootPath + '/resources/js/console.ts', library: { name: 'Console', type: 'window', export: 'Console' } },
'datetimepicker': rootPath + '/resources/js/datetimepicker.ts',
'database/central_columns': rootPath + '/resources/js/database/central_columns.ts',
'database/events': rootPath + '/resources/js/database/events.ts',
'database/multi_table_query': rootPath + '/resources/js/database/multi_table_query.ts',
'database/operations': rootPath + '/resources/js/database/operations.ts',
'database/query_generator': rootPath + '/resources/js/database/query_generator.ts',
'database/routines': rootPath + '/resources/js/database/routines.ts',
'database/search': rootPath + '/resources/js/database/search.ts',
'database/structure': rootPath + '/resources/js/database/structure.ts',
'database/tracking': rootPath + '/resources/js/database/tracking.ts',
'designer/init': rootPath + '/resources/js/designer/init.ts',
'drag_drop_import': rootPath + '/resources/js/drag_drop_import.ts',
'error_report': rootPath + '/resources/js/error_report.ts',
'export': rootPath + '/resources/js/export.ts',
'export_output': rootPath + '/resources/js/export_output.ts',
'gis_data_editor': rootPath + '/resources/js/gis_data_editor.ts',
'home': rootPath + '/resources/js/home.ts',
'import': rootPath + '/resources/js/import.ts',
'jquery.sortable-table': rootPath + '/resources/js/jquery.sortable-table.ts',
'main': rootPath + '/resources/js/main.ts',
'makegrid': rootPath + '/resources/js/makegrid.ts',
'menu_resizer': rootPath + '/resources/js/menu_resizer.ts',
'multi_column_sort': rootPath + '/resources/js/multi_column_sort.ts',
'normalization': rootPath + '/resources/js/normalization.ts',
'replication': rootPath + '/resources/js/replication.ts',
'server/databases': rootPath + '/resources/js/server/databases.ts',
'server/plugins': rootPath + '/resources/js/server/plugins.ts',
'server/privileges': rootPath + '/resources/js/server/privileges.ts',
'server/status/monitor': rootPath + '/resources/js/server/status/monitor.ts',
'server/status/processes': rootPath + '/resources/js/server/status/processes.ts',
'server/status/queries': rootPath + '/resources/js/server/status/queries.ts',
'server/status/variables': rootPath + '/resources/js/server/status/variables.ts',
'server/user_groups': rootPath + '/resources/js/server/user_groups.ts',
'server/variables': rootPath + '/resources/js/server/variables.ts',
'setup/scripts': rootPath + '/resources/js/setup/scripts.ts',
'shortcuts_handler': rootPath + '/resources/js/shortcuts_handler.ts',
'sql': rootPath + '/resources/js/sql.ts',
'table/change': rootPath + '/resources/js/table/change.ts',
'table/chart': rootPath + '/resources/js/table/chart.ts',
'table/find_replace': rootPath + '/resources/js/table/find_replace.ts',
'table/gis_visualization': rootPath + '/resources/js/table/gis_visualization.ts',
'table/operations': rootPath + '/resources/js/table/operations.ts',
'table/relation': rootPath + '/resources/js/table/relation.ts',
'table/select': rootPath + '/resources/js/table/select.ts',
'table/structure': rootPath + '/resources/js/table/structure.ts',
'table/tracking': rootPath + '/resources/js/table/tracking.ts',
'table/zoom_search': rootPath + '/resources/js/table/zoom_search.ts',
'transformations/image_upload': rootPath + '/resources/js/transformations/image_upload.ts',
'transformations/json': rootPath + '/resources/js/transformations/json.ts',
'transformations/json_editor': rootPath + '/resources/js/transformations/json_editor.ts',
'transformations/sql_editor': rootPath + '/resources/js/transformations/sql_editor.ts',
'transformations/xml': rootPath + '/resources/js/transformations/xml.ts',
'transformations/xml_editor': rootPath + '/resources/js/transformations/xml_editor.ts',
'triggers': rootPath + '/resources/js/triggers.ts',
'u2f': rootPath + '/resources/js/u2f.ts',
'validator-messages': rootPath + '/resources/js/validator-messages.ts',
'webauthn': rootPath + '/resources/js/webauthn.ts',
},
output: {
filename: '[name].js',
path: publicPath + '/js',
},
optimization: {
chunkIds: 'named',
moduleIds: 'named',
runtimeChunk: 'single',
splitChunks: {
cacheGroups: {
shared: { name: 'shared', chunks: 'all', minChunks: 2, minSize: 1 },
bootstrap: {
priority: 10,
test: /[\\/]node_modules[\\/](bootstrap|@popperjs)[\\/]/,
name: 'bootstrap',
filename: 'vendor/[name]/[name].js',
chunks: 'all',
enforce: true,
},
openLayers: {
priority: 10,
test: /[\\/]node_modules[\\/](ol|rbush)[\\/]/,
name: 'openlayers',
filename: 'vendor/[name]/[name].js',
chunks: 'all',
enforce: true,
},
},
},
},
externals: {
jquery: 'jQuery',
codemirror: 'CodeMirror',
},
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
use: [
{ loader: 'babel-loader', options: { presets: ['@babel/preset-env'] } },
{ loader: 'ts-loader', options: { ignoreDiagnostics: typeScriptErrorsToIgnore } },
],
},
{
test: /\.js$/,
exclude: /node_modules/,
use: { loader: 'babel-loader', options: { presets: ['@babel/preset-env'] } },
},
],
},
plugins: [
new CopyPlugin({
patterns: [
{ from: rootPath + '/node_modules/codemirror/addon/hint/sql-hint.js', to: publicPath + '/js/vendor/codemirror/addon/hint/sql-hint.js' },
{ from: rootPath + '/node_modules/codemirror/addon/hint/show-hint.css', to: publicPath + '/js/vendor/codemirror/addon/hint/show-hint.css' },
{ from: rootPath + '/node_modules/codemirror/addon/hint/show-hint.js', to: publicPath + '/js/vendor/codemirror/addon/hint/show-hint.js' },
{ from: rootPath + '/node_modules/codemirror/addon/runmode/runmode.js', to: publicPath + '/js/vendor/codemirror/addon/runmode/runmode.js' },
{ from: rootPath + '/node_modules/codemirror/addon/lint/lint.css', to: publicPath + '/js/vendor/codemirror/addon/lint/lint.css' },
{ from: rootPath + '/node_modules/codemirror/addon/lint/lint.js', to: publicPath + '/js/vendor/codemirror/addon/lint/lint.js' },
{ from: rootPath + '/node_modules/codemirror/lib/codemirror.js', to: publicPath + '/js/vendor/codemirror/lib/codemirror.js' },
{ from: rootPath + '/node_modules/codemirror/lib/codemirror.css', to: publicPath + '/js/vendor/codemirror/lib/codemirror.css' },
{ from: rootPath + '/node_modules/codemirror/mode/sql/sql.js', to: publicPath + '/js/vendor/codemirror/mode/sql/sql.js' },
{ from: rootPath + '/node_modules/codemirror/mode/javascript/javascript.js', to: publicPath + '/js/vendor/codemirror/mode/javascript/javascript.js' },
{ from: rootPath + '/node_modules/codemirror/mode/xml/xml.js', to: publicPath + '/js/vendor/codemirror/mode/xml/xml.js' },
{ from: rootPath + '/node_modules/codemirror/LICENSE', to: publicPath + '/js/vendor/codemirror/LICENSE', toType: 'file' },
{ from: rootPath + '/node_modules/jquery/dist/jquery.min.js', to: publicPath + '/js/vendor/jquery/jquery.min.js' },
{ from: rootPath + '/node_modules/jquery/dist/jquery.min.map', to: publicPath + '/js/vendor/jquery/jquery.min.map' },
{ from: rootPath + '/node_modules/jquery/LICENSE.txt', to: publicPath + '/js/vendor/jquery/MIT-LICENSE.txt' },
{ from: rootPath + '/node_modules/jquery-migrate/dist/jquery-migrate.min.js', to: publicPath + '/js/vendor/jquery/jquery-migrate.min.js' },
{ from: rootPath + '/node_modules/jquery-migrate/dist/jquery-migrate.min.map', to: publicPath + '/js/vendor/jquery/jquery-migrate.min.map' },
{ from: rootPath + '/node_modules/jquery-ui-dist/jquery-ui.min.js', to: publicPath + '/js/vendor/jquery/jquery-ui.min.js' },
{ from: rootPath + '/node_modules/jquery-validation/dist/jquery.validate.min.js', to: publicPath + '/js/vendor/jquery/jquery.validate.min.js' },
{ from: rootPath + '/node_modules/jquery-validation/dist/additional-methods.min.js', to: publicPath + '/js/vendor/jquery/additional-methods.min.js' },
{ from: rootPath + '/node_modules/js-cookie/dist/js.cookie.min.js', to: publicPath + '/js/vendor/js.cookie.min.js' },
{ from: rootPath + '/node_modules/@zxcvbn-ts/core/dist/zxcvbn-ts.js', to: publicPath + '/js/vendor/zxcvbn-ts.js' },
{ from: rootPath + '/node_modules/@zxcvbn-ts/core/dist/zxcvbn-ts.js.map', to: publicPath + '/js/vendor/zxcvbn-ts.js.map' },
{ from: rootPath + '/node_modules/tracekit/tracekit.js', to: publicPath + '/js/vendor/tracekit.js' },
{ from: rootPath + '/node_modules/u2f-api-polyfill/u2f-api-polyfill.js', to: publicPath + '/js/vendor/u2f-api-polyfill.js' },
{ from: rootPath + '/node_modules/jquery-uitablefilter/jquery.uitablefilter.js', to: publicPath + '/js/vendor/jquery/jquery.uitablefilter.js' },
{ from: rootPath + '/node_modules/tablesorter/dist/js/jquery.tablesorter.js', to: publicPath + '/js/vendor/jquery/jquery.tablesorter.js' },
{ from: rootPath + '/node_modules/jquery-ui-timepicker-addon/dist/jquery-ui-timepicker-addon.min.js', to: publicPath + '/js/vendor/jquery/jquery-ui-timepicker-addon.min.js' },
{ from: rootPath + '/node_modules/ol/ol.css', to: publicPath + '/js/vendor/openlayers/openlayers.css' },
{ from: rootPath + '/node_modules/locutus.sprintf/src/php/strings/sprintf.browser.js', to: publicPath + '/js/vendor/sprintf.js' },
{ from: rootPath + '/node_modules/chart.js/dist/chart.umd.js', to: publicPath + '/js/vendor/chart.umd.js' },
{ from: rootPath + '/node_modules/chart.js/dist/chart.umd.js.map', to: publicPath + '/js/vendor/chart.umd.js.map' },
{ from: rootPath + '/node_modules/chartjs-adapter-date-fns/dist/chartjs-adapter-date-fns.bundle.js', to: publicPath + '/js/vendor/chartjs-adapter-date-fns.bundle.js' },
{ from: rootPath + '/node_modules/chartjs-plugin-zoom/dist/chartjs-plugin-zoom.js', to: publicPath + '/js/vendor/chartjs-plugin-zoom.js' },
{ from: rootPath + '/node_modules/hammerjs/hammer.js', to: publicPath + '/js/vendor/hammer.js' },
],
}),
],
},
{
name: 'CSS',
mode: 'none',
devtool: 'source-map',
entry: {
'public/themes/bootstrap/css/theme': publicPath + '/themes/bootstrap/scss/theme.scss',
'public/themes/metro/css/theme': publicPath + '/themes/metro/scss/theme.scss',
'public/themes/original/css/theme': publicPath + '/themes/original/scss/theme.scss',
'public/themes/pmahomme/css/theme': publicPath + '/themes/pmahomme/scss/theme.scss',
'public/setup/styles': publicPath + '/setup/scss/styles.scss',
},
output: {
filename: 'build/css/[name].js',
path: rootPath,
},
module: {
rules: [
{
test: /\.scss$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: {
url: false,
},
},
{
loader: 'postcss-loader',
options: {
postcssOptions: {
plugins: [ autoprefixer() ],
},
},
},
'sass-loader',
],
},
],
},
plugins: [
new MiniCssExtractPlugin({
filename: '[name].css',
chunkFilename: '[id].css',
}),
new RtlCssPlugin({
filename: '[name].rtl.css',
}),
],
},
];