-
Notifications
You must be signed in to change notification settings - Fork 116
/
webpack.js
40 lines (33 loc) · 1.24 KB
/
webpack.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
/**
* SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
const path = require('path')
const webpackConfig = require('@nextcloud/webpack-vue-config')
const webpackRules = require('@nextcloud/webpack-vue-config/rules')
const BabelLoaderExcludeNodeModulesExcept = require('babel-loader-exclude-node-modules-except')
webpackConfig.entry = {
viewer: path.join(__dirname, 'src', 'viewer.js'),
fileActions: path.join(__dirname, 'src', 'file-actions.js'),
document: path.join(__dirname, 'src', 'document.js'),
admin: path.join(__dirname, 'src', 'admin.js'),
personal: path.join(__dirname, 'src', 'personal.js'),
reference: path.join(__dirname, 'src', 'reference.js'),
public: path.join(__dirname, 'src', 'public.js'),
}
webpackRules.RULE_JS.test = /\.m?js$/
webpackRules.RULE_JS.exclude = BabelLoaderExcludeNodeModulesExcept([
'@nextcloud/dialogs',
'@nextcloud/event-bus',
])
// Replaces rules array
webpackConfig.module.rules = Object.values(webpackRules)
// Raw files rule
webpackConfig.module.rules.push({
resourceQuery: /raw/,
type: 'asset/source',
})
// Add typescript extension resolver
webpackConfig.resolve.extensions.push('.tsx')
// Export final config
module.exports = webpackConfig