summaryrefslogtreecommitdiffstats
path: root/webpack.config.js
blob: 8220c40a5f560372d08bb2a0a7ca498886df1306 (plain)
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
const path = require('node:path')

const { EsbuildPlugin } = require('esbuild-loader')
const webpack = require('webpack')
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
const { mergeWithRules } = require('webpack-merge')

const nextcloudWebpackConfig = require('@nextcloud/webpack-vue-config')

const commonWebpackConfig = require('./webpack.common.config.js')

module.exports = mergeWithRules({
	module: {
		// Rules from @nextcloud/webpack-vue-config/rules already added by commonWebpackConfig
		rules: 'replace',
	},
	optimization: {
		minimizer: 'replace',
	},
})(nextcloudWebpackConfig, commonWebpackConfig, {
	entry: {
		'admin-settings': path.join(__dirname, 'src', 'mainAdminSettings.js'),
		collections: path.join(__dirname, 'src', 'collections.js'),
		main: path.join(__dirname, 'src', 'main.js'),
		recording: path.join(__dirname, 'src', 'mainRecording.js'),
		'files-sidebar': [
			path.join(__dirname, 'src', 'mainFilesSidebar.js'),
			path.join(__dirname, 'src', 'mainFilesSidebarLoader.js'),
		],
		'public-share-auth-sidebar': path.join(__dirname, 'src', 'mainPublicShareAuthSidebar.js'),
		'public-share-sidebar': path.join(__dirname, 'src', 'mainPublicShareSidebar.js'),
		flow: path.join(__dirname, 'src', 'flow.js'),
		dashboard: path.join(__dirname, 'src', 'dashboard.js'),
		deck: path.join(__dirname, 'src', 'deck.js'),
		maps: path.join(__dirname, 'src', 'maps.js'),
	},

	output: {
		assetModuleFilename: '[name][ext]?v=[contenthash]',
	},

	optimization: {
		minimizer: [
			new EsbuildPlugin({
				target: 'es2020',
			}),
		],
	},

	plugins: [
	/*	new BundleAnalyzerPlugin({
			analyzerMode: 'static',
		}), */

		new webpack.DefinePlugin({ IS_DESKTOP: false }),

		// Ignore moment locales by default and import only curent locale implicitly
		// @see https://webpack.js.org/plugins/ignore-plugin#example-of-ignoring-moment-locales
		new webpack.IgnorePlugin({
			resourceRegExp: /^\.[\\/]locale$/,
			contextRegExp: /moment$/,
		}),
	],

	cache: true,
})